{"action":"opened","issue":{"url":"https://api.github.com/repos/desihub/specsim/issues/49","repository_url":"https://api.github.com/repos/desihub/specsim","labels_url":"https://api.github.com/repos/desihub/specsim/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/desihub/specsim/issues/49/comments","events_url":"https://api.github.com/repos/desihub/specsim/issues/49/events","html_url":"https://github.com/desihub/specsim/issues/49","id":182340622,"number":49,"title":"changing airmass doesn't work for Simulator object","user":{"login":"sbailey","id":218471,"avatar_url":"https://avatars.githubusercontent.com/u/218471?v=3","gravatar_id":"","url":"https://api.github.com/users/sbailey","html_url":"https://github.com/sbailey","followers_url":"https://api.github.com/users/sbailey/followers","following_url":"https://api.github.com/users/sbailey/following{/other_user}","gists_url":"https://api.github.com/users/sbailey/gists{/gist_id}","starred_url":"https://api.github.com/users/sbailey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbailey/subscriptions","organizations_url":"https://api.github.com/users/sbailey/orgs","repos_url":"https://api.github.com/users/sbailey/repos","events_url":"https://api.github.com/users/sbailey/events{/privacy}","received_events_url":"https://api.github.com/users/sbailey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"dkirkby","id":185007,"avatar_url":"https://avatars.githubusercontent.com/u/185007?v=3","gravatar_id":"","url":"https://api.github.com/users/dkirkby","html_url":"https://github.com/dkirkby","followers_url":"https://api.github.com/users/dkirkby/followers","following_url":"https://api.github.com/users/dkirkby/following{/other_user}","gists_url":"https://api.github.com/users/dkirkby/gists{/gist_id}","starred_url":"https://api.github.com/users/dkirkby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkirkby/subscriptions","organizations_url":"https://api.github.com/users/dkirkby/orgs","repos_url":"https://api.github.com/users/dkirkby/repos","events_url":"https://api.github.com/users/dkirkby/events{/privacy}","received_events_url":"https://api.github.com/users/dkirkby/received_events","type":"User","site_admin":false},"assignees":[{"login":"dkirkby","id":185007,"avatar_url":"https://avatars.githubusercontent.com/u/185007?v=3","gravatar_id":"","url":"https://api.github.com/users/dkirkby","html_url":"https://github.com/dkirkby","followers_url":"https://api.github.com/users/dkirkby/followers","following_url":"https://api.github.com/users/dkirkby/following{/other_user}","gists_url":"https://api.github.com/users/dkirkby/gists{/gist_id}","starred_url":"https://api.github.com/users/dkirkby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkirkby/subscriptions","organizations_url":"https://api.github.com/users/dkirkby/orgs","repos_url":"https://api.github.com/users/dkirkby/repos","events_url":"https://api.github.com/users/dkirkby/events{/privacy}","received_events_url":"https://api.github.com/users/dkirkby/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2016-10-11T18:37:26Z","updated_at":"2016-10-11T18:37:26Z","closed_at":null,"body":"I think this is a bug, but it might be user error:  I create a Simulator object, simulate a spectrum, and then change the airmass and simulate it again.  I'm getting the same sky vector back.  However, if I create two different Simulator objects, I get back two different sky vectors as expected.\r\n\r\nWorks:\r\n```python\r\nimport specsim.simulator\r\nfrom specsim.atmosphere import Moon\r\nimport astropy.units as u\r\n\r\nwave = np.arange(3500, 9900) * u.Angstrom\r\nflux = np.zeros(len(wave)) * u.erg / (u.s * u.cm**2 * u.Angstrom)\r\n\r\nqsim1 = specsim.simulator.Simulator('desi')\r\nqsim1.observation.exposure_time = 1000 * u.s\r\nqsim1.atmosphere.airmass = 1.0\r\nqsim1.source.update_in('sky', 'sky', wave, flux)\r\nqsim1.source.update_out()\r\nqsim1.simulate()\r\n\r\nqsim2 = specsim.simulator.Simulator('desi')\r\nqsim2.observation.exposure_time = 1000 * u.s\r\nqsim2.atmosphere.airmass = 2.0\r\nqsim2.source.update_in('sky', 'sky', wave, flux)\r\nqsim2.source.update_out()\r\nqsim2.simulate()\r\n\r\nsky1 = qsim1.camera_output[2]['num_sky_electrons']\r\nsky2 = qsim2.camera_output[2]['num_sky_electrons']\r\n\r\nnp.all(sky1-sky2 != 0)\r\n```\r\n\r\nFails (same sky vector despite different airmasses):\r\n```python\r\nimport specsim.simulator\r\nfrom specsim.atmosphere import Moon\r\nimport astropy.units as u\r\n\r\nqsim = specsim.simulator.Simulator('desi')\r\nqsim.observation.exposure_time = 1000 * u.s\r\n\r\nwave = np.arange(3500, 9900) * u.Angstrom\r\nflux = np.zeros(len(wave)) * u.erg / (u.s * u.cm**2 * u.Angstrom)\r\n\r\nqsim.atmosphere.airmass = 1.0\r\nqsim.source.update_in('sky', 'sky', wave, flux)\r\nqsim.source.update_out()\r\nqsim.simulate()\r\nwx = qsim.camera_output[2]['wavelength']\r\nsky1 = qsim.camera_output[2]['num_sky_electrons']\r\n\r\nqsim.atmosphere.airmass = 2.0\r\nqsim.source.update_in('sky', 'sky', wave, flux)\r\nqsim.source.update_out()\r\nqsim.simulate()\r\nsky2 = qsim.camera_output[2]['num_sky_electrons']\r\n\r\nnp.all(sky1-sky2 != 0)\r\n```\r\nI'm using specsim master."}}
{"actor":{"display_login":"sbailey"}}