Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imsim.py crashes if there are no stars in the instance catalog #67

Closed
jchiang87 opened this issue Sep 13, 2017 · 7 comments
Closed

imsim.py crashes if there are no stars in the instance catalog #67

jchiang87 opened this issue Sep 13, 2017 · 7 comments

Comments

@jchiang87
Copy link
Collaborator

The problem is that when phoSimStarCatalog.get_fitsFiles() is called, there are no objects to be simulated and no bandPassDict is created because of
https://github.com/lsst/sims_GalSimInterface/blob/master/python/lsst/sims/GalSimInterface/galSimCatalogs.py#L358
and this line in imsim.py
https://github.com/LSSTDESC/imSim/blob/master/bin.src/imsim.py#L153
fails with

Traceback (most recent call last):
  File "/gpfs/slac/kipac/fs1/g/desc/imsim_deep/imSim/bin/imsim.py", line 179, in <module>
    main()
  File "/gpfs/slac/kipac/fs1/g/desc/imsim_deep/imSim/bin/imsim.py", line 165, in main
    phoSimGalaxyCatalog.copyGalSimInterpreter(phoSimStarCatalog)
  File "/gpfs/slac/kipac/fs1/g/desc/imsim_deep/PRs/sims_GalSimInterface/python/lsst/sims/GalSimInterface/galSimCatalogs.py", line 429, in copyGalSimInterpreter
    self.bandpassDict = otherCatalog.bandpassDict
AttributeError: 'ImSimStars' object has no attribute 'bandpassDict'
@danielsf
Copy link
Contributor

We can probably fix this by putting

if otherCatalog.hasBeenInitialized:
    self.bandpassDict = otherCatalog.bandpassDict
    self.galSimInterpreter = otherCatalog.galSimInterpreter

here
https://github.com/lsst/sims_GalSimInterface/blob/master/python/lsst/sims/GalSimInterface/galSimCatalogs.py#L418

Then, the first catalog that contains objects will initialize the GalSimInterpreter

@danielsf
Copy link
Contributor

Do you want me to deal with this, or have you already done something?

@jchiang87
Copy link
Collaborator Author

Let's hold off for now. There may be other related issues that come up as I go through my testing for the PRs.

@danielsf
Copy link
Contributor

OK

@jchiang87
Copy link
Collaborator Author

@danielsf I just tried your proposed fix, and it worked fine, so I'm ok with proceeding this way.

@danielsf
Copy link
Contributor

Okay. I will just add it to the existing GalSimInterface PR

@danielsf
Copy link
Contributor

I just merged the sims_GalSimInterface PR, including the fix to this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants