{"action":"created","issue":{"url":"https://api.github.com/repos/astropy/astropy/issues/4414","labels_url":"https://api.github.com/repos/astropy/astropy/issues/4414/labels{/name}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/4414/comments","events_url":"https://api.github.com/repos/astropy/astropy/issues/4414/events","html_url":"https://github.com/astropy/astropy/issues/4414","id":123825293,"number":4414,"title":"Compound model expressions not displayed when printing compound model instances","user":{"login":"embray","id":676149,"avatar_url":"https://avatars.githubusercontent.com/u/676149?v=3","gravatar_id":"","url":"https://api.github.com/users/embray","html_url":"https://github.com/embray","followers_url":"https://api.github.com/users/embray/followers","following_url":"https://api.github.com/users/embray/following{/other_user}","gists_url":"https://api.github.com/users/embray/gists{/gist_id}","starred_url":"https://api.github.com/users/embray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/embray/subscriptions","organizations_url":"https://api.github.com/users/embray/orgs","repos_url":"https://api.github.com/users/embray/repos","events_url":"https://api.github.com/users/embray/events{/privacy}","received_events_url":"https://api.github.com/users/embray/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/astropy/astropy/labels/Affects-release","name":"Affects-release","color":"0052cc"},{"url":"https://api.github.com/repos/astropy/astropy/labels/Bug","name":"Bug","color":"eb6420"},{"url":"https://api.github.com/repos/astropy/astropy/labels/Effort-medium","name":"Effort-medium","color":"fef2c0"},{"url":"https://api.github.com/repos/astropy/astropy/labels/modeling","name":"modeling","color":"c7def8"},{"url":"https://api.github.com/repos/astropy/astropy/labels/Package-novice","name":"Package-novice","color":"bfe5bf"},{"url":"https://api.github.com/repos/astropy/astropy/labels/Priority-Medium","name":"Priority-Medium","color":"fdbb84"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-24T18:11:49Z","updated_at":"2016-01-12T10:33:28Z","closed_at":null,"body":"Currently, if you create a compound model class and then print it out, the display of the class shows the expression that was used to create it:\r\n\r\n```\r\n<class '__main__.CompoundModel1'>\r\nName: CompoundModel1\r\nInputs: ('x',)\r\nOutputs: ('y',)\r\nFittable parameters: ('amplitude_0', 'mean_0', 'stddev_0', 'amplitude_1', 'mean_1', 'stddev_1')\r\nExpression: [0] + [1]\r\nComponents: \r\n    [0]: <class 'astropy.modeling.functional_models.Gaussian1D'>\r\n    Name: Gaussian1D\r\n    Inputs: ('x',)\r\n    Outputs: ('y',)\r\n    Fittable parameters: ('amplitude', 'mean', 'stddev')\r\n\r\n    [1]: <class 'astropy.modeling.functional_models.Gaussian1D'>\r\n    Name: Gaussian1D\r\n    Inputs: ('x',)\r\n    Outputs: ('y',)\r\n    Fittable parameters: ('amplitude', 'mean', 'stddev')\r\n```\r\n\r\nHere the expression is shown as `[0] + [1]`, where the numeric indices are used for terseness.  One can then look at the list of components to see what each component of the expression is.  I've long held that this display could be improved, but I don't have a great idea for how, yet.  Please suggest something! \r\n\r\nBut anyways the point of this bug is that while the *class* shows the components properly, if you print a compound model instance it doesn't give any useful information about the components:\r\n\r\n```\r\nIn [23]: TwoGaussians = Gaussian1D + Gaussian1D\r\n\r\nIn [24]: gg = TwoGaussians(1, 0, 0.1, 1, 0.5, 0.3)\r\n\r\nIn [25]: print(gg)\r\nModel: CompoundModel2\r\nInputs: ('x',)\r\nOutputs: ('y',)\r\nModel set size: 1\r\nParameters:\r\n    amplitude_0 mean_0 stddev_0 amplitude_1 mean_1 stddev_1\r\n    ----------- ------ -------- ----------- ------ --------\r\n            1.0    0.0      0.1         1.0    0.5      0.3\r\n```\r\n\r\nOne can certainly print the class of the model like: `print(type(gg))`, but that's rather obtuse.  The model instance should show all the components just as the model class does.\r\n\r\nI think this should be easy enough for a novice to fix, with a bit of effort."},"comment":{"url":"https://api.github.com/repos/astropy/astropy/issues/comments/170868740","html_url":"https://github.com/astropy/astropy/issues/4414#issuecomment-170868740","issue_url":"https://api.github.com/repos/astropy/astropy/issues/4414","id":170868740,"user":{"login":"anchitjain1234","id":4551357,"avatar_url":"https://avatars.githubusercontent.com/u/4551357?v=3","gravatar_id":"","url":"https://api.github.com/users/anchitjain1234","html_url":"https://github.com/anchitjain1234","followers_url":"https://api.github.com/users/anchitjain1234/followers","following_url":"https://api.github.com/users/anchitjain1234/following{/other_user}","gists_url":"https://api.github.com/users/anchitjain1234/gists{/gist_id}","starred_url":"https://api.github.com/users/anchitjain1234/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anchitjain1234/subscriptions","organizations_url":"https://api.github.com/users/anchitjain1234/orgs","repos_url":"https://api.github.com/users/anchitjain1234/repos","events_url":"https://api.github.com/users/anchitjain1234/events{/privacy}","received_events_url":"https://api.github.com/users/anchitjain1234/received_events","type":"User","site_admin":false},"created_at":"2016-01-12T10:33:28Z","updated_at":"2016-01-12T10:33:28Z","body":"I would like to work on this bug.\r\nI am able to replicate it but not able to figure out where code of compound modeling is present. [This](https://github.com/astropy/astropy/blob/master/astropy/modeling/_compound_deprecated.py)  file is related to compound modeling but it is deprecated."}}