initial disc update - #53
IainHammond wants to merge 52 commits into
Conversation
# Conflicts: # heeps/contrast/disc.py
|
Thanks for this PR!
|
|
Thanks Gilles, I will take a look into your first two points tomorrow. I re-named a lot of my parameters when converting this so it's possible I got the transmission wrong. I agree about the the post-processing just going into a demo which I will get started on soon |
|
I might change the RDI section to be its own function |
@GillesOrban |
|
f_oat refers to the RAVC because the default config simulate the RAVC. In the datapack (downloaded from the gdrive), there is a |
oabsil
left a comment
There was a problem hiding this comment.
Hi @IainHammond, I've finally found the time to take a look at your pull request. I've dropped four comments on the disc.py function. In addition to these detailed comments, can I also please ask you to provide the example notebook requested by @GillesOrban to illustrate the use of disc.py? This would be most useful to wrap up this pull request and start using your contribution.
| assert psf_OFF.ndim == 2, "off-axis PSF frame must be 2-dimensional" | ||
|
|
||
| # crop everything to a common size | ||
| min_crop = min(psf_OFF.shape[-1], disc_model.shape[-1], conf["ndet"]) |
There was a problem hiding this comment.
Not sure why the off-axis PSF is used for cropping here, as the disc will be injected into the on-axis PSF cube. More generally, I'm not sure what's the use of the off-axis PSF in RDI except for flux normalisation, which probably doesn't need any cropping to be done?
| if disc_model.shape[-1] > min_crop: | ||
| disc_model = frame_crop(disc_model, min_crop, verbose=False) | ||
|
|
||
| # apply extinction if requested |
There was a problem hiding this comment.
I must admit that this option is a bit mysterious to me. Can you clarify what the use case is? Would that pertain to the location of an injected protoplanet, for which you would want to explore the effect of extinction without having to produce a new disc image each time you start a simulation?
| cube /= star_val | ||
|
|
||
| # add the disc model | ||
| psf_ON += cube |
There was a problem hiding this comment.
This assumes that psf_ON is normalised in a way where the stellar flux is equal to one in the off-axis PSF (total intensity in the off-axis PSF image = 1). This is however not the case: in the PSF data base, the on- and off-axis PSFs are normalised so that the total intensity of the non-coronagraphic PSF is equal to one. The difference between the non-coronagraphic PSF and the off-axis PSF in the coronagraphic mode comes from the throughtput of the Lyot stop and from the intrinsic transmission of the vortex phase mask. The disc cube needs to be multiplied by the throughput of the coronagraphic mode relative to the non-coronagraphic mode to have the same normalisation as psf_ON. This can be done through something like: psf_ON += (cube * np.sum(psf_OFF))
There was a problem hiding this comment.
@GillesOrban just warned me that the scaling with the off-axis PSF flux may already be taken care of through the convolution with pst_OFF in the call to cube_inject_fakedisk with the option normalize_psf=False. It seems indeed to be the case, as far as I can tell from a quick look at that function. It would still be useful to add a note in the code to keep that in mind.
| extinction : Union[int, float], default=0 | ||
| Extinction in magnitudes to apply to the source at ``source_xy``. | ||
| starphot : float, default=1e11 | ||
| Photometric scaling factor for the star. |
There was a problem hiding this comment.
I think this requires a bit more explanation. From what I understand this is the off-axis stellar photon flux per sec at the detector in an aperture of diameter equal to the FWHM of the (off-axis) PSF.
Updated 23/07:
Adding disc.py for the purposes of disc forward modelling. I've kept it tidy, verbose and to the point. It should work with most RT codes. The process is pretty self explanatory:
Caveat regarding RDI: due to the 0.5 mag increment of the PSF grid, it's possible that the reference star will have the same PSF sequence as the science cube. In this case, the code takes a segment from the end of the science sequence to use as the reference, so they are still independent.
Possibly the next thing to add:
Bonus: adding noise is now much faster, and psf_template had a clean up