chandra_aca.centroid_resid¶
- class chandra_aca.centroid_resid.CentroidResiduals(start, stop)[source]¶
Class to calculate star centroid residuals.
This class is designed to set up and perform the residual calculations on any desired combination of source centroids and source attitudes. For the common use cases, centroids, attitudes, and commanded star positions are retrieved automatically from archived sources.
Based on analysis, time offsets are applied to centroid times by default. See fit notebooks in:
http://nbviewer.jupyter.org/url/cxc.harvard.edu/mta/ASPECT/ipynb/centroid_time_offsets/OR.ipynb
and
http://nbviewer.jupyter.org/url/cxc.harvard.edu/mta/ASPECT/ipynb/centroid_time_offsets/ER.ipynb
Users should see the class method
for_slot
for a convenient way to get centroid residuals on anobsid
for an ACAslot
(aka image number).Example usage:
>>> import numpy as np >>> from chandra_aca.centroid_resid import CentroidResiduals >>> cr = CentroidResiduals.for_slot(obsid=20001, slot=5) >>> np.max(np.abs(cr.dyags)) 0.87602233734844503 >>> np.max(np.abs(cr.dzags)) 1.2035827855862777 >>> cr.atts[0] array([-0.07933254, 0.87065874, -0.47833673, 0.08278696]) >>> cr.agasc_id 649201816
This example calculates the residuals on slot 5 of obsid 20001 using the ground aspect solution and ground centroids. Here is another example that does the same thing without using the
for_slot
convenience.Example usage:
>>> import numpy as np >>> from chandra_aca.centroid_resid import CentroidResiduals >>> cr = CentroidResiduals(start='2017:169:18:54:50.138', stop='2017:170:05:13:58.190') >>> cr.set_atts('ground') >>> cr.set_centroids('ground', slot=5) >>> cr.set_star(agasc_id=649201816) >>> cr.calc_residuals() >>> np.max(np.abs(cr.dyags)) 0.87602233734844503
- Parameters:
start – start time of interval for residuals (DateTime compatible)
stop – stop time of interval for residuals (DateTime compatible)
- calc_residuals()[source]¶
Calculate star residuals.
Calculate residuals based on attitude and ra/dec of star. Note that the sampling and times of yags may be different from zags so these should be done independently.
Residuals are available in self.dyags and self.dzags. Predicted values from attitude and star position in self.pred_yags and self.pred_zags
- set_atts(source)[source]¶
Get attitude solution quaternions from
source
.One could also just set atts and att_times attributes directly.
- set_centroids(source, slot, alg=8, apply_dt=True)[source]¶
Assign centroids.
Assign centroids from
source
andslot
to the objects centroid attributes (yag, zag, yag_times, zag_times)For the supported sources (ground, obc) the centroids are fetched from the mica L1 archive or telemetry.
yag, zag, yag_times an zag_times can also be set directly without use of this method.
- Parameters:
- source
‘ground’ | ‘obc’
- slot
ACA slot
- alg
for ground processing, use centroids from this algorithm.
- apply_dt
apply centroid time offsets via ‘set_offsets’
- set_offsets()[source]¶
Apply time offsets to centroids.
Apply time offsets to centroids based on type and source of centroid, obsid (suggesting 8x8 or 6x6 data), telemetry source (‘maude’ or ‘cxc’) and aspect solution source. These time offsets were fit. See fit notebooks at:
http://nbviewer.jupyter.org/url/cxc.harvard.edu/mta/ASPECT/ipynb/centroid_time_offsets/OR.ipynb
and
http://nbviewer.jupyter.org/url/cxc.harvard.edu/mta/ASPECT/ipynb/centroid_time_offsets/ER.ipynb