{"action":"created","issue":{"url":"https://api.github.com/repos/astropy/astropy/issues/3393","labels_url":"https://api.github.com/repos/astropy/astropy/issues/3393/labels{/name}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/3393/comments","events_url":"https://api.github.com/repos/astropy/astropy/issues/3393/events","html_url":"https://github.com/astropy/astropy/issues/3393","id":55937019,"number":3393,"title":"Add conditional mapping model","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/Effort-medium","name":"Effort-medium","color":"fef2c0"},{"url":"https://api.github.com/repos/astropy/astropy/labels/Feature%20Request","name":"Feature Request","color":"bfdadc"},{"url":"https://api.github.com/repos/astropy/astropy/labels/modeling","name":"modeling","color":"c7def8"},{"url":"https://api.github.com/repos/astropy/astropy/labels/Package-intermediate","name":"Package-intermediate","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-29T18:24:37Z","updated_at":"2015-01-30T14:53:08Z","closed_at":null,"body":"I still need to think some on exactly what it would look like, but a special type of [mapping model](http://docs.astropy.org/en/latest/modeling/compound-models.html#advanced-mappings) that selects between different models depending on a conditional expression would also be useful.  If handled carefully, this should hopefully make it mostly straightforward to define piecewise functions in the compound model framework."},"comment":{"url":"https://api.github.com/repos/astropy/astropy/issues/comments/72212470","html_url":"https://github.com/astropy/astropy/issues/3393#issuecomment-72212470","issue_url":"https://api.github.com/repos/astropy/astropy/issues/3393","id":72212470,"user":{"login":"mhvk","id":2789820,"avatar_url":"https://avatars.githubusercontent.com/u/2789820?v=3","gravatar_id":"","url":"https://api.github.com/users/mhvk","html_url":"https://github.com/mhvk","followers_url":"https://api.github.com/users/mhvk/followers","following_url":"https://api.github.com/users/mhvk/following{/other_user}","gists_url":"https://api.github.com/users/mhvk/gists{/gist_id}","starred_url":"https://api.github.com/users/mhvk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhvk/subscriptions","organizations_url":"https://api.github.com/users/mhvk/orgs","repos_url":"https://api.github.com/users/mhvk/repos","events_url":"https://api.github.com/users/mhvk/events{/privacy}","received_events_url":"https://api.github.com/users/mhvk/received_events","type":"User","site_admin":false},"created_at":"2015-01-30T14:53:08Z","updated_at":"2015-01-30T14:53:08Z","body":"A risk here is that the selection/mapping model has to become fully aware of dimensions of inputs, etc. Possibly, the logic for what to select should not reside in the mapping/selecting model, but in the models underneath, which could, say, return `None` or `False` or `NaN` when input is outside of their region of validity. Then, one would only need a joining model that selects the one (and only one) valid set of results. Or maybe more simply there would be a validation wrapper for models that does the above.\r\n\r\nBut I do worry that if one were to proceed along these paths before too long a whole new programming language would have been defined..."}}