{"action":"closed","issue":{"url":"https://api.github.com/repos/pynbody/pynbody/issues/238","labels_url":"https://api.github.com/repos/pynbody/pynbody/issues/238/labels{/name}","comments_url":"https://api.github.com/repos/pynbody/pynbody/issues/238/comments","events_url":"https://api.github.com/repos/pynbody/pynbody/issues/238/events","html_url":"https://github.com/pynbody/pynbody/issues/238","id":58734864,"number":238,"title":"profiles return rms for any 3-letter suffix to the quantity name","user":{"login":"jakobherpich","id":5030846,"avatar_url":"https://avatars.githubusercontent.com/u/5030846?v=3","gravatar_id":"","url":"https://api.github.com/users/jakobherpich","html_url":"https://github.com/jakobherpich","followers_url":"https://api.github.com/users/jakobherpich/followers","following_url":"https://api.github.com/users/jakobherpich/following{/other_user}","gists_url":"https://api.github.com/users/jakobherpich/gists{/gist_id}","starred_url":"https://api.github.com/users/jakobherpich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakobherpich/subscriptions","organizations_url":"https://api.github.com/users/jakobherpich/orgs","repos_url":"https://api.github.com/users/jakobherpich/repos","events_url":"https://api.github.com/users/jakobherpich/events{/privacy}","received_events_url":"https://api.github.com/users/jakobherpich/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-24T13:00:50Z","updated_at":"2015-02-24T17:24:17Z","closed_at":"2015-02-24T17:24:17Z","body":"If you define a new particle array in pynbody, any profile will return the rms of that value if this name is given a 3-letter suffix:\r\n```\r\nIn [14]: @pynbody.derived_array\r\n   ....: def new(sim):\r\n   ....:     return sim['vz']\r\n   ....: \r\n\r\nIn [15]: prof['vz_rms'] - prof['vz_med']\r\nOut[15]: \r\nSimArray([ 139.32150469,  123.55090558,   94.0637332 ,   72.90883376,\r\n         61.34109607,   52.67153461,   45.36292228,   41.26242749,\r\n         38.64398263,   35.50721396,   34.07014255,   31.5824049 ,\r\n         28.73718148,   26.78879671,   25.18875347,   23.6772909 ,\r\n         23.41781483,   23.78409552,   22.37957934,   20.09178889,\r\n         20.2632743 ,   19.37450908,   18.27975705,   18.58815656,\r\n         17.52212151,   16.72366797,   15.33089036,   13.07331952,\r\n         14.44228554,   15.49199012,   11.96057366,   13.86535309,\r\n         13.31195753,   11.76899769,   11.47051043,   10.07110493,\r\n         12.55383036,   12.42052377,    8.79601782,   14.55286701,\r\n          9.84575728,   12.67301186,   11.16727406,    6.39274529,\r\n         11.48517749,    4.8257448 ,    6.75825839,    6.68612943,\r\n         10.44367312,    4.9721719 ,    1.65448058,    2.34008856,\r\n         13.69292466,    6.7496634 ,    1.6685665 ,    3.10303995,\r\n          4.94265697,   12.59976981,    6.63684616,    0.83665639], '1.00e+00 km s**-1')\r\n\r\nIn [16]: prof['new_rms'] - prof['new_med']\r\nOut[16]: \r\nSimArray([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,\r\n        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,\r\n        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,\r\n        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,\r\n        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.])\r\n\r\nIn [17]: prof['new_foo'] - prof['new_rms']\r\nOut[17]: \r\nSimArray([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,\r\n        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,\r\n        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,\r\n        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,\r\n        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.])\r\n```\r\n\r\nIn particular this breaks the median calculation for any quantity that is not predefined in the profile class.\r\n\r\nThe cause is that in the `_get_profile()` method of the `Profile` class we have the following situation\r\n```\r\nif ... and ... or ... [or ...]:\r\n```\r\nin lines 355, 362, 368 and 374. These lines need parentheses:\r\n```\r\nif ... and (... or ... [or ...]):\r\n```"}}