{"action":"created","comment":{"url":"https://api.github.com/repos/astropy/astropy/pulls/comments/23110338","id":23110338,"diff_hunk":"@@ -34,8 +38,8 @@ def mapping(self):\n         return self._mapping\n \n     def evaluate(self, *args):\n-        if len(args) < self.n_inputs:\n-            raise TypeError('{0} expects at most {1} inputs; got {2}'.format(\n+        if len(args) != self.n_inputs:\n+            raise TypeError('{0} expects {1} inputs; got {2}'.format(","path":"astropy/modeling/mappings.py","position":24,"original_position":24,"commit_id":"312511db4ed72a9a09c1cac79ff5a2aa506096bc","original_commit_id":"312511db4ed72a9a09c1cac79ff5a2aa506096bc","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},"body":"For swapping, just as an example, you didn't *have* to specify all indices.  For example, you could write something like `Mapping((1, 0))` and that would swap the first and second inputs, but pass any others (2 or above) through.  I don't have any strong feelings about whether that's preferable though.","created_at":"2015-01-16T21:22:08Z","updated_at":"2015-01-16T21:22:08Z","html_url":"https://github.com/astropy/astropy/pull/3297#discussion_r23110338","pull_request_url":"https://api.github.com/repos/astropy/astropy/pulls/3297","_links":{"self":{"href":"https://api.github.com/repos/astropy/astropy/pulls/comments/23110338"},"html":{"href":"https://github.com/astropy/astropy/pull/3297#discussion_r23110338"},"pull_request":{"href":"https://api.github.com/repos/astropy/astropy/pulls/3297"}}},"pull_request":{"url":"https://api.github.com/repos/astropy/astropy/pulls/3297","id":27380867,"html_url":"https://github.com/astropy/astropy/pull/3297","diff_url":"https://github.com/astropy/astropy/pull/3297.diff","patch_url":"https://github.com/astropy/astropy/pull/3297.patch","issue_url":"https://api.github.com/repos/astropy/astropy/issues/3297","number":3297,"state":"open","locked":false,"title":"fix Mapping.inverse","user":{"login":"nden","id":1110361,"avatar_url":"https://avatars.githubusercontent.com/u/1110361?v=3","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},"body":"`Mapping.inverse` is incorrect when duplicating inputs:\r\n\r\n```\r\nm = Mapping((0, 1, 0))\r\nm.inverse.n_inputs\r\n2\r\nm.inverse.n_outputs\r\n2\r\n```\r\nThis causes the inverse of compound models to fail because the inputs don't match the outputs any more.\r\n\r\n```\r\nmodel = Shift(1) & Shift(2) | m | (Scale(1) & Scale(2) & Scale(3)\r\n```\r\n\r\nThis PR provides a fix for this problem, although in somewhat kludgy way. The problem is that `Mapping` accepts arbitrary number of inputs. And there's no way to initialize a model by specifying how many inputs will be passed.\r\n\r\nThis PR also adds docstrings and changes the two models in such a way that now a `name` argument can be passed in when a model is initialized.\r\n\r\n","created_at":"2015-01-14T20:31:53Z","updated_at":"2015-01-16T21:22:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c2fed3d84b1c01e6a2a76a8c629b8df5e9514874","assignee":null,"milestone":{"url":"https://api.github.com/repos/astropy/astropy/milestones/15","labels_url":"https://api.github.com/repos/astropy/astropy/milestones/15/labels","id":643887,"number":15,"title":"v1.0.0","description":"","creator":{"login":"astrofrog","id":314716,"avatar_url":"https://avatars.githubusercontent.com/u/314716?v=3","gravatar_id":"","url":"https://api.github.com/users/astrofrog","html_url":"https://github.com/astrofrog","followers_url":"https://api.github.com/users/astrofrog/followers","following_url":"https://api.github.com/users/astrofrog/following{/other_user}","gists_url":"https://api.github.com/users/astrofrog/gists{/gist_id}","starred_url":"https://api.github.com/users/astrofrog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astrofrog/subscriptions","organizations_url":"https://api.github.com/users/astrofrog/orgs","repos_url":"https://api.github.com/users/astrofrog/repos","events_url":"https://api.github.com/users/astrofrog/events{/privacy}","received_events_url":"https://api.github.com/users/astrofrog/received_events","type":"User","site_admin":false},"open_issues":25,"closed_issues":194,"state":"open","created_at":"2014-04-29T16:03:02Z","updated_at":"2015-01-16T19:12:16Z","due_on":"2015-01-23T05:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/astropy/astropy/pulls/3297/commits","review_comments_url":"https://api.github.com/repos/astropy/astropy/pulls/3297/comments","review_comment_url":"https://api.github.com/repos/astropy/astropy/pulls/comments/{number}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/3297/comments","statuses_url":"https://api.github.com/repos/astropy/astropy/statuses/312511db4ed72a9a09c1cac79ff5a2aa506096bc","head":{"label":"nden:mapping-inverse","ref":"mapping-inverse","sha":"312511db4ed72a9a09c1cac79ff5a2aa506096bc","user":{"login":"nden","id":1110361,"avatar_url":"https://avatars.githubusercontent.com/u/1110361?v=3","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},"repo":{"id":6738136,"name":"astropy","full_name":"nden/astropy","owner":{"login":"nden","id":1110361,"avatar_url":"https://avatars.githubusercontent.com/u/1110361?v=3","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},"private":false,"html_url":"https://github.com/nden/astropy","description":"Main AstroPy repository","fork":true,"url":"https://api.github.com/repos/nden/astropy","forks_url":"https://api.github.com/repos/nden/astropy/forks","keys_url":"https://api.github.com/repos/nden/astropy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nden/astropy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nden/astropy/teams","hooks_url":"https://api.github.com/repos/nden/astropy/hooks","issue_events_url":"https://api.github.com/repos/nden/astropy/issues/events{/number}","events_url":"https://api.github.com/repos/nden/astropy/events","assignees_url":"https://api.github.com/repos/nden/astropy/assignees{/user}","branches_url":"https://api.github.com/repos/nden/astropy/branches{/branch}","tags_url":"https://api.github.com/repos/nden/astropy/tags","blobs_url":"https://api.github.com/repos/nden/astropy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nden/astropy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nden/astropy/git/refs{/sha}","trees_url":"https://api.github.com/repos/nden/astropy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nden/astropy/statuses/{sha}","languages_url":"https://api.github.com/repos/nden/astropy/languages","stargazers_url":"https://api.github.com/repos/nden/astropy/stargazers","contributors_url":"https://api.github.com/repos/nden/astropy/contributors","subscribers_url":"https://api.github.com/repos/nden/astropy/subscribers","subscription_url":"https://api.github.com/repos/nden/astropy/subscription","commits_url":"https://api.github.com/repos/nden/astropy/commits{/sha}","git_commits_url":"https://api.github.com/repos/nden/astropy/git/commits{/sha}","comments_url":"https://api.github.com/repos/nden/astropy/comments{/number}","issue_comment_url":"https://api.github.com/repos/nden/astropy/issues/comments/{number}","contents_url":"https://api.github.com/repos/nden/astropy/contents/{+path}","compare_url":"https://api.github.com/repos/nden/astropy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nden/astropy/merges","archive_url":"https://api.github.com/repos/nden/astropy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nden/astropy/downloads","issues_url":"https://api.github.com/repos/nden/astropy/issues{/number}","pulls_url":"https://api.github.com/repos/nden/astropy/pulls{/number}","milestones_url":"https://api.github.com/repos/nden/astropy/milestones{/number}","notifications_url":"https://api.github.com/repos/nden/astropy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nden/astropy/labels{/name}","releases_url":"https://api.github.com/repos/nden/astropy/releases{/id}","created_at":"2012-11-17T18:06:04Z","updated_at":"2014-06-06T19:38:34Z","pushed_at":"2015-01-16T19:29:29Z","git_url":"git://github.com/nden/astropy.git","ssh_url":"git@github.com:nden/astropy.git","clone_url":"https://github.com/nden/astropy.git","svn_url":"https://github.com/nden/astropy","homepage":"astropy.org","size":32470,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"astropy:master","ref":"master","sha":"c87a87e9ea9fd85e8dbef3b2535758a0fa22245f","user":{"login":"astropy","id":847984,"avatar_url":"https://avatars.githubusercontent.com/u/847984?v=3","gravatar_id":"","url":"https://api.github.com/users/astropy","html_url":"https://github.com/astropy","followers_url":"https://api.github.com/users/astropy/followers","following_url":"https://api.github.com/users/astropy/following{/other_user}","gists_url":"https://api.github.com/users/astropy/gists{/gist_id}","starred_url":"https://api.github.com/users/astropy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astropy/subscriptions","organizations_url":"https://api.github.com/users/astropy/orgs","repos_url":"https://api.github.com/users/astropy/repos","events_url":"https://api.github.com/users/astropy/events{/privacy}","received_events_url":"https://api.github.com/users/astropy/received_events","type":"Organization","site_admin":false},"repo":{"id":2081289,"name":"astropy","full_name":"astropy/astropy","owner":{"login":"astropy","id":847984,"avatar_url":"https://avatars.githubusercontent.com/u/847984?v=3","gravatar_id":"","url":"https://api.github.com/users/astropy","html_url":"https://github.com/astropy","followers_url":"https://api.github.com/users/astropy/followers","following_url":"https://api.github.com/users/astropy/following{/other_user}","gists_url":"https://api.github.com/users/astropy/gists{/gist_id}","starred_url":"https://api.github.com/users/astropy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astropy/subscriptions","organizations_url":"https://api.github.com/users/astropy/orgs","repos_url":"https://api.github.com/users/astropy/repos","events_url":"https://api.github.com/users/astropy/events{/privacy}","received_events_url":"https://api.github.com/users/astropy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/astropy/astropy","description":"Repository for the Astropy core package","fork":false,"url":"https://api.github.com/repos/astropy/astropy","forks_url":"https://api.github.com/repos/astropy/astropy/forks","keys_url":"https://api.github.com/repos/astropy/astropy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/astropy/astropy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/astropy/astropy/teams","hooks_url":"https://api.github.com/repos/astropy/astropy/hooks","issue_events_url":"https://api.github.com/repos/astropy/astropy/issues/events{/number}","events_url":"https://api.github.com/repos/astropy/astropy/events","assignees_url":"https://api.github.com/repos/astropy/astropy/assignees{/user}","branches_url":"https://api.github.com/repos/astropy/astropy/branches{/branch}","tags_url":"https://api.github.com/repos/astropy/astropy/tags","blobs_url":"https://api.github.com/repos/astropy/astropy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/astropy/astropy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/astropy/astropy/git/refs{/sha}","trees_url":"https://api.github.com/repos/astropy/astropy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/astropy/astropy/statuses/{sha}","languages_url":"https://api.github.com/repos/astropy/astropy/languages","stargazers_url":"https://api.github.com/repos/astropy/astropy/stargazers","contributors_url":"https://api.github.com/repos/astropy/astropy/contributors","subscribers_url":"https://api.github.com/repos/astropy/astropy/subscribers","subscription_url":"https://api.github.com/repos/astropy/astropy/subscription","commits_url":"https://api.github.com/repos/astropy/astropy/commits{/sha}","git_commits_url":"https://api.github.com/repos/astropy/astropy/git/commits{/sha}","comments_url":"https://api.github.com/repos/astropy/astropy/comments{/number}","issue_comment_url":"https://api.github.com/repos/astropy/astropy/issues/comments/{number}","contents_url":"https://api.github.com/repos/astropy/astropy/contents/{+path}","compare_url":"https://api.github.com/repos/astropy/astropy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/astropy/astropy/merges","archive_url":"https://api.github.com/repos/astropy/astropy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/astropy/astropy/downloads","issues_url":"https://api.github.com/repos/astropy/astropy/issues{/number}","pulls_url":"https://api.github.com/repos/astropy/astropy/pulls{/number}","milestones_url":"https://api.github.com/repos/astropy/astropy/milestones{/number}","notifications_url":"https://api.github.com/repos/astropy/astropy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/astropy/astropy/labels{/name}","releases_url":"https://api.github.com/repos/astropy/astropy/releases{/id}","created_at":"2011-07-21T01:33:49Z","updated_at":"2015-01-16T20:54:26Z","pushed_at":"2015-01-16T21:02:06Z","git_url":"git://github.com/astropy/astropy.git","ssh_url":"git@github.com:astropy/astropy.git","clone_url":"https://github.com/astropy/astropy.git","svn_url":"https://github.com/astropy/astropy","homepage":"www.astropy.org","size":54911,"stargazers_count":490,"watchers_count":490,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":334,"mirror_url":null,"open_issues_count":407,"forks":334,"open_issues":407,"watchers":490,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/astropy/astropy/pulls/3297"},"html":{"href":"https://github.com/astropy/astropy/pull/3297"},"issue":{"href":"https://api.github.com/repos/astropy/astropy/issues/3297"},"comments":{"href":"https://api.github.com/repos/astropy/astropy/issues/3297/comments"},"review_comments":{"href":"https://api.github.com/repos/astropy/astropy/pulls/3297/comments"},"review_comment":{"href":"https://api.github.com/repos/astropy/astropy/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/astropy/astropy/pulls/3297/commits"},"statuses":{"href":"https://api.github.com/repos/astropy/astropy/statuses/312511db4ed72a9a09c1cac79ff5a2aa506096bc"}}}}