kammerje / spaceKLIP

Pipeline for reducing JWST high-contrast imaging data. Published in Kammerer et al. 2022 and Carter et al. 2022.
https://ui.adsabs.harvard.edu/abs/2022SPIE12180E..3NK/abstract
MIT License
16 stars 9 forks source link

Add kwargs for forward modeling variables, input planet spectrum for psf gen #181

Closed wbalmer closed 1 month ago

wbalmer commented 1 month ago

Adds kwargs for each of the currently hard coded forward model variables, as well as a kwarg to specify an input planetary spectrum when generating the psf in extract_companions.

I tested this on the ERS F444W dataset and reproduced the expected behavior of extract_companions in this case. Example kwargs:

Analysis.extract_companions(companions, 
                                starfile, 
                                mstar_err, 
                                klmode=5,
                                spectral_type='A2V', 
                                fitmethod='mcmc',
                                fitkernel='diag',
                                subdir='companions',
                                planetfile='./HIP65426b_BTSETTL_SCALED_MU_JY.txt',
                                boxsize=30,
                                dr=3,
                                exclr=3,
                                xrange=3,
                                yrange=3,
                                frange=[-1e-1,1e1],
                                nthreads=16,
                                corr_len_range=[-10,10]
                            )

Turns out you get different values comparing the develop behavior vs this branch's behavior using an appropriate temperature spectrum for a bright enough companion. Obviously matters more for the widest filters.

kammerje commented 1 month ago

@AarynnCarter This looks pretty straight forward to me and contains an important bugfix, so I think you can go ahead and merge it.

wbalmer commented 1 month ago

Thanks for looking it over @kammerje - I just had to make one correction to the default parameters (dr 5 -> 3, to avoid some issues with the default boxsize of 31). This should be good to merge now, I've tested it on multiple datasets with the default parameters, and permutations of the various kwargs.