{"action":"created","issue":{"url":"https://api.github.com/repos/astropy/astropy/issues/7224","repository_url":"https://api.github.com/repos/astropy/astropy","labels_url":"https://api.github.com/repos/astropy/astropy/issues/7224/labels{/name}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/7224/comments","events_url":"https://api.github.com/repos/astropy/astropy/issues/7224/events","html_url":"https://github.com/astropy/astropy/issues/7224","id":299139132,"number":7224,"title":"Do not allow changing parameter units in model instances","user":{"login":"nden","id":1110361,"avatar_url":"https://avatars2.githubusercontent.com/u/1110361?v=4","gravatar_id":"","url":"https://api.github.com/users/nden","html_url":"https://github.com/nden","followers_url":"https://api.github.com/users/nden/followers","following_url":"https://api.github.com/users/nden/following{/other_user}","gists_url":"https://api.github.com/users/nden/gists{/gist_id}","starred_url":"https://api.github.com/users/nden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nden/subscriptions","organizations_url":"https://api.github.com/users/nden/orgs","repos_url":"https://api.github.com/users/nden/repos","events_url":"https://api.github.com/users/nden/events{/privacy}","received_events_url":"https://api.github.com/users/nden/received_events","type":"User","site_admin":false},"labels":[{"id":35800382,"url":"https://api.github.com/repos/astropy/astropy/labels/modeling","name":"modeling","color":"c7def8","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-02-21T21:42:01Z","updated_at":"2018-02-22T14:35:36Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Raised by @perrygreenfield in #7204 \r\n\r\nOne thing I think should change is that it should not be possible to assign new units to a Parameter instance (E.g. this currently works:\r\n\r\ng = Gaussian1D(1 * u.J, 1 * u.m, 0.1 * u.m)\r\n\r\ng.amplitude = 2 * u.s\r\ng.mean = 2 * u.Jy\r\n\r\nI can't see the justification for allowing this. If a model with different unit support is needed, make a new one, don't mutate an existing one. Seems like this is asking for trouble.\r\n\r\n@astrofrog @Cadair "},"comment":{"url":"https://api.github.com/repos/astropy/astropy/issues/comments/367699585","html_url":"https://github.com/astropy/astropy/issues/7224#issuecomment-367699585","issue_url":"https://api.github.com/repos/astropy/astropy/issues/7224","id":367699585,"user":{"login":"perrygreenfield","id":981803,"avatar_url":"https://avatars0.githubusercontent.com/u/981803?v=4","gravatar_id":"","url":"https://api.github.com/users/perrygreenfield","html_url":"https://github.com/perrygreenfield","followers_url":"https://api.github.com/users/perrygreenfield/followers","following_url":"https://api.github.com/users/perrygreenfield/following{/other_user}","gists_url":"https://api.github.com/users/perrygreenfield/gists{/gist_id}","starred_url":"https://api.github.com/users/perrygreenfield/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/perrygreenfield/subscriptions","organizations_url":"https://api.github.com/users/perrygreenfield/orgs","repos_url":"https://api.github.com/users/perrygreenfield/repos","events_url":"https://api.github.com/users/perrygreenfield/events{/privacy}","received_events_url":"https://api.github.com/users/perrygreenfield/received_events","type":"User","site_admin":false},"created_at":"2018-02-22T14:35:36Z","updated_at":"2018-02-22T14:35:36Z","author_association":"MEMBER","body":"@astrofrog Inconsistencies won't be picked up in the following cases:\r\n\r\n- The model is not intrinsically using Quantities but just the value assumed to be a particular unit.\r\n- In cases where the parameter unit is arbitrary (i.e., does not affect the computation at all; a good example is amplitude in Gaussian1D) it won't result in an error at evaluation. In cases where the output unit isn't critical that isn't a problem. But supposing the model is promising a physical quantity, it would simply be wrong.\r\n\r\nHandling equivalencies could be done for parameters like anything else by assigning an attribute listing allowed equivalencies. \r\n\r\nI figure is someone defined a model with specific units, they had a good reason to do so and it shouldn't be permitted to fiddle with them."}}
{"actor":{"display_login":"perrygreenfield"}}