Exo-TiC / ExoTiC-ISM

This is a repository for the reduction pipeline detailed in Wakeford, et al., 2016, ApJ. The method implements marginalization across a series of models to represent stochastic models for observatory and instrument systematics. This is primarily for HST WFC3, however, may be extended to STIS in the future.
MIT License
8 stars 6 forks source link

Incorporating red and white noise calculator #51

Closed hrwakeford closed 5 years ago

hrwakeford commented 5 years ago

Taking #44 and converting the IDL to python functions to calculate the white and red noise for each systematic model in run 2.

hrwakeford commented 5 years ago

I have added in the function noise_calculator to margmodule.py

The noise calculator will take the residuals from the second fit and calculate the white and red noise, and the beta fitting factor as an added way of determining the goodness of fit. These are then saved in the sys_stats array and output for the best weight model in the pdf file.

The red line is the expected noise binning statistic, the black line shows the measured noise binning statistic. RMS_test_1 In this case [white, red, beta] = (0.00016548114346879786, 1.8735671960958826e-05, 1.061465820214402)

I ran a number of tests on the routine and found that if the data is good (as the G141 data is) you get NaNs for these values as they achieve better than the expected standard noise values. In this case the values are replaced with (0,0,1) which demonstrates a good fit to the data with no red or white noise and a fitting factor of unity.

Again, the red line is the expected noise binning statistic, the black line shows the measured noise binning statistic. Here you can see a majority of the data is below the red line showing a better than expected level of noise. This will be common with WFC3 IR datasets due to the low number of data points and the accuracy of the data. RMS_test_2

ivalaginja commented 5 years ago

In your comment above, what is the difference between the two plots? Are those just from two different sets of residuals (two different systematic models)?

The code looks really good! I went in and updated the docstring for the noise_calculator() function to make it like the rest, and updated some of the formatting.

I also added a legend and title to the noise plot and a comment: This plot will be instructive when we start building unit tests for the code, so it should absolutely stay in there, even if commented out. We just need to label it properly so that we know what’s going on in it when we come back to it later, hence my change request in the review.

hrwakeford commented 5 years ago

I have added the requested changes to the plot labels.