Closed rmjarvis closed 11 months ago
Separate from that, I was surprised that this function was still being called. @jchiang87 Can we please change the code in SkyCatalog where it makes the SED objects to use interpolant='linear' so this step doesn't have to be done? It would be faster to have them built correctly from the start rather than fix them here.
Sure, you just had to ask back when you saw the issue.
Great. I think we had a conversation about this back then, but it probably never got formalized and written down as an actual issue, so it slipped through the cracks. I should have posted an issue about it on the skycatalogs repo.
@cwwalter and I have independently tried running this branch with GalSim 2.5 (i.e., in my case, with the current GalSim main). Bright stars seem to being rendered with small stamps instead of as bright stars with diffraction spikes. Here's a comparison showing a field with a bright star rendered using GalSim 2.4.11 and the imSim code in main (left) and GalSim 2.5 + this branch (right):
Weird. I'm having trouble reproducing that behavior.
If I change the second item in the example_instance_catalog (i.e. the first one that falls on the image) to either 14.84 or 15.84, I get diffraction spikes. In both cases (this branch / galsim main or imsim main / galsim 2.4.11), the first one is FFT with stamp size 1382, and the second one is phot with stamp size 760.
Here are the images: This branch/2.5:
Main branch/2.4.11:
Any idea what would be different about this compared to what you're doing (presumably with the skycatalog)?
Have to run to class, but both Jim and I are using the skyCatalogs for this test. That is one difference.
Sure. The problem is it's harder to adjust the flux with a skycat object. And there aren't any FFT stars in our example skycat file.
We do have bright stars in our test data. In examples/imsim-user-skycat.yaml, setting
input.sky_catalog.obj_types: [star]
will use the skyCatalogs stars and reproduces the issue.
Ah! Thanks. I didn't notice that we were restricting to only galaxies by default in that file.
I tracked down the problem, and I've pushed a fix. (It's from an optimization in GalSim 2.5 that ends up changing one of our isinstance tests to not do what it used to do.)
I'd like to add a unit test about this to check that stamp sizes come out right for a range of object types. But if you want to, feel free to try again with your tests to check if it seems to be fixed there.
Great! Will do.
Thanks, Mike! Looks good for me:
I think I addressed all the comments from Jim. I also added a new test function that makes stamps for a bunch of different kinds of objects and checks that the sizes make sense. So if we ever hit some other change that breaks the stamp size calculations, we should notice.
I tried to hit basically every branch in that function, which required a bit of fiddling, since there aren't any hugely bright galaxies in the input db, where the bright galaxy adjustments make sense. Nor do we have any extremely faint objects. I could fiddle parameters to test some things that happen at faint fluxes. But the one branch I couldn't (at least easily) include is when the realized flux is 0, and it early exists without drawing. Probably ok, since that bit of code doesn't seem as fragile as the parts I am testing, but just mentioning that omission.
The test is failing, I think because I tuned the flux values to use the new throughputs in #422. Once that is merged, I think the test should start working. Other than that, I think this is ready to go if anyone else wants to take a look.
I changed the default nbatch to 100 regardless of checkpointing. There is a comment about this in the main config file.
This fixes a few things that were incompatible with the upcoming GalSIm 2.5.
if galsim.__version_info__ < (2,5)
to still build the image if on 2.4.x, but not on 2.5.obj * sed
is agalsim.SimpleChromaticTransformation
, so that required some changes to tests in test_stamp.py, which make specific assumptions about object types._fix_seds_*
functions, and we copy one of them to the_fix_seds
name depending on the GalSim version.Separate from that, I was surprised that this function was still being called. @jchiang87 Can we please change the code in SkyCatalog where it makes the SED objects to use
interpolant='linear'
so this step doesn't have to be done? It would be faster to have them built correctly from the start rather than fix them here.