Quadband 2023
November 15th status:
reworked the extraction algorithm to better capture data.
Current algorithm for isolating a band:
from the detectObjectsInExp
set of footprints we isolate the centroids that are located in a window of 50 pixel around the center of mass estimated centerX
which is essentially a flux weighted x coordinate. Doing this we should find 5 centroids, the 0 order star and the 4 first order bands. If this is the case we proceed to the next step:
Advanced Flux estimation
We focus on just the AMP where the band should be located.
We start by defining new bin edges along the y-coordinate, these edges are determined by the following:
- the left most footprint box's y-value minus 2 times
yWindow
(default 50) - the mean between the second footprint's box min y-value and the max y-value of the first box
- the mean between the third box's min y-value and the max y-value of the second box
- the mean between the fourth box's min y-value and the max y-value of the third box
- the max y-value of the fourth box plus the
yWindow
Reasoning for the extends on either end is that we seem to more often be struggling with accurately capturing the beginning of the first band, and the detectObjectsInExp
is often cutting the band off.
With this bin_edges
defined we next find the mid point of each bin (mid_y)
this is the bands centroid coordinate in the y-direction
to find centroid coordinate in the x direction, we take the median of a cross-section of the 10 pixel rows around mid_y, we call this
x_data
Next we normalize x_data
as:
x_norm = (x_data - x_data.min())/(x_data.max() - x_data.min())
To this we fit a double Gaussian function:
Gauss(x) = a*exp(-(x-mean)^2 /(2*sigma_1^2)) + (1-a)*exp(-(x-mean)^2/(2*sigma_2^2))
with fitting parameters a, mean, sigma_1, sigma_2
Notice that we are using the same value for mean
for both gaussian functions, this is cause the mean
is the same as the center in the x-direction. The reason for 2 gaussians is that we use one to capture the massive spike of data, and the second is used to capture the tails of the data curve. Currently we are using scipy.optimize.curve_fit
as our fit function, we provide an initial guess p0=[0.5, initial_centroid_x, 3, 20]
and bounds: (0,
[1,400,25,100]
)
The values from the fit are used to first find the centroid, and then to estimate a fwhm for either gaussian peak:
fwhm_i = 2*sqrt(2*log(2))*sigma_i
To obtain a more reliable fwhm we can use to generate our aperture I have tried the following:
fwhm = max(fwhm_1, fwhm_2)
fwhm = fwhm_1 + fwhm_2 * (1-a)
fwhm = a*fwhm_1 + 2*(1-a) *fwhm_2
I am currently trying out using the last line. Next to estimate the bin we know that for a Gaussian to capture 99.95% of the flux in it, we would have to make our window 1.5*fwhm
, since we aren't completely Gaussian I have widened it to 1.75*fwhm
, and then I finally also artificially widen our bin by an extra 10 pixel on either side. An example of a diagnostics plot:
Copyright © 2024 The President and Fellows of Harvard College * Accessibility * Support * Request Access * Terms of Use