jennykim1016 / SLRealizer

Catalog-level simulation of LSST DM stack measurements of gravitationally-lensed quasars.
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Size fixed - everything changed dramatically #60

Open jennykim1016 opened 7 years ago

jennykim1016 commented 7 years ago

Just finished running the code for all the LSST-like OM10 systems (2234 systems).

I used the same code as before; the only change is the change in OM10 effective radius. Everything changed dramatically. This change was the most obvious in magnitudes/color.

magnitude

In $u$ band, we can see that the deblended sources are much much brighter (~2 mags, five times brighter) than the SDSS galaxies. $g$ and $r$ band it's the same, and for the other bands OM10 systems are dimmer.. This suggests that the quasar images are dominating.

This is the cornerplot that I produced with the change in the data. changed_cornerplot

Feature importance: cutoff

Feature importance is dominated by $u-z$.

ROC curve has improved too much I think.. roc

jennykim1016 commented 7 years ago

Hi @drphilmarshall @mbaumer ,

Even though the most recent figure looks a little suspicious, for the DESC note, I think it would be more reasonable to use the most recent data that takes the real REFFs into account. Would that be okay, or would you recommend me to use the figures that I used for my poster? Thanks!

drphilmarshall commented 7 years ago

We should use the non-zero sizes if we can, in the Note. But they need checking carefully, Jenny: the overall magnitude of the lens systems should not change much, if all that you are doing is spreading the flux of the lens galaxy out into an extended galaxy (with non-zero size). Is your total flux calculation accurate? (Are you integrating out to large enough radii?) Are you computing flux per pixel correctly, with the extended galaxy model?

mbaumer commented 7 years ago

Hi Jenny, I share Phil's concerns, given that a magnitude is a total flux, so changing the size (spreading the light out over more area) shouldn't affect the total flux. Also, keep in mind that giving size to the reddish lens galaxy should make our simulated lQSO systems look more like SDSS galaxies, broadly speaking. As far as where the bug might be, I would look back at your code that sets the normalization of the realized Gaussians based on the magnitudes. It's important to remember the constant out front which sets the amplitude has a factor of 1/(sqrt(2pi)sigma) along with it, meaning that for a larger source of fixed total flux, the peak value of the gaussian should be lower... Mike

On Tue, Sep 5, 2017 at 11:02 AM Phil Marshall notifications@github.com wrote:

We should use the non-zero sizes if we can, in the Note. But they need checking carefully, Jenny: the overall magnitude of the lens systems should not change much, if all that you are doing is spreading the flux of the lens galaxy out into an extended galaxy (with non-zero size). Is your total flux calculation accurate? (Are you integrating out to large enough radii?) Are you computing flux per pixel correctly, with the extended galaxy model?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/jennykim1016/SLRealizer/issues/60#issuecomment-327256453, or mute the thread https://github.com/notifications/unsubscribe-auth/AHQVT3_cnZ9BfAxDr2PsJulkkeS9byADks5sfYzOgaJpZM4PMg6s .

jennykim1016 commented 7 years ago

Hi @drphilmarshall @mbaumer ,

Thank you so much for your comments! I only used Galsim to calculate all the moments. I've unit tested the function calls and made sure that it's returning the same flux regardless of the radius by writing the codes along the lines of:

galaxy = galsim.Gaussian(flux=10.0, sigma=10) img = galaxy.drawImage(scale=.2) flux = shape_info.moments_amp # total image intensity for best-fit elliptical Gaussian from adaptive moments. Normally, this field is simply equal to the image flux (for objects that follow a Gaussian light distribution, otherwise it is something approximating the flux). Then I change the flux into the magnitude using the Pogson's equation. Here, while unit testing, regardless of which values I put, I get the original input flux back... I also tested for adding multiple gaussians -- Galsim accurately returns the expected total flux.

I think the error might be caused by ignoring the constant as @mbaumer suggested, but there is one thing that I am not sure. First, doesn't the flux define the (integrated) magnitude (2.5log(F1/F2))? I think it makes sense that the surface brightness will get dimmer when the source is spreaded -- would we need to calculate the surface brightness?

Thanks!

drphilmarshall commented 7 years ago

You're right, the surface brightness of the PSF-blurred extended galaxy will be lower than the surface brightness of the PSF-blurred point source. Your pixel values are proportional to the surface brightness, so you are already calculating it. The relation between magnitude and flux is just m = 22.5 - 2.5*log_10(F) where F has units of nanomaggies: both m and F are integrated quantities. Let us know what happens when you include the normalization factor!

jennykim1016 commented 7 years ago

Hi @drphilmarshall ,

Thanks! I was a little confused about the normalization before. I think Galsim definitely takes the normalization into account (the more extended the source is, the dimmer the surface brightness will be), and the returned total flux from Galsim that I get is the integrated flux. This total flux does not change whether I put Reff=0 or Reff=10 for instance.

In addition, I just realized this change actually wasn't from the size; I think I created a really weird bug when I was cleaning up the code. If I do not calculate the size in the current branch (REFF=0), I get the following cornerplot:

magnitude

which is definitely off. However, if I run the same code in the master branch without fixing the size (REFF==0 for all galaxies), I get the following (50 random lenses, 100 random observation epochs):

magnitude_master

and if I change the size to have a real size, I get the following (50 random lenses different from the second ones, 100 random observation epochs different from the second ones):

galaxy_size

which both makes sense. I will start comparing the master branch with the current branch to see where I made the bug... Sorry about the confusion!