-
Notifications
You must be signed in to change notification settings - Fork 5
Machine uses perturbation class #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Machine uses perturbation class #60
Conversation
Co-authored-by: Jorge Martínez-Palomera <[email protected]>
95d05bc to
5e2de68
Compare
Co-authored-by: Jorge Martínez-Palomera <[email protected]>
… into machine-perturbation
… into machine-perturbation
…o machine-perturbation
Co-authored-by: Christina Hedges <[email protected]>
jorgemarpa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@christinahedges I reviewed this PR again, added some minor docstrings, and removed duplicated functions in utils.py.
It looks Ok to me. Please review again before merging
christinahedges
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good, just two very minor docstring changes and then I will merge
src/psfmachine/perturbation.py
Outdated
| def pca(self, y, ncomponents=5, smooth_time_scale=0): | ||
| """Adds the principal components of `y` to the design matrix | ||
| Will add two time scales of principal components, definied by `long_time_scale` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't true anymore can we fix this docstring here?
| pixels_in_tpf = np.ones_like(self.row, dtype=bool) | ||
|
|
||
| # enheance pixel mask | ||
| time_corr = np.nanpercentile(bkg_flux, 20, axis=1)[:, None] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this 20%? Is this why stuff goes negative so often? Can you add a short docstring explainer about what's going on here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That part is only used to create a naive model of the background as a function of time to then find and mask out variable pixels. So it does not play into building the bkg model.
Changing the percentile will only change which pixels to look at in the distribution each time.
This PR adapts
machineto use the newperturbationclasses introduced in #59.It modifies the following methods:
self.build_time_model()self.plot_time_model()self.fit_models()self._get_perturbed_model(), computes the perturbed matrix for a given time.It adds a new attribute
self.P3which is aPerturbationMatrix3Dobject that manages the perturbation matrix.TODO:
EDIT:
The original
mac.time_corrector = "pos_corr", "centroid"options can be mimic by including the following arguments toPerturbationMatrix3Dat initialization:other_vectors = [poscorr1, poscorr2, poscorr1 * poscorr2], poly_order=0. In this way the perturbation matrix will use only the centroids/poscorr as components with no time.