ChebyFits¶
- class rubin_sim.moving_objects.ChebyFits(orbits_obj, t_start, t_span, time_scale='TAI', obscode=807, sky_tolerance=2.5, n_coeff_position=14, n_coeff_vmag=9, n_coeff_delta=5, n_coeff_elongation=6, ngran=64, eph_file=None, n_decimal=10)¶
Bases:
object
Generates chebyshev coefficients for a provided set of orbits.
Calculates true ephemerides using PyEphemerides, then fits these positions with a constrained Chebyshev Polynomial, using the routines in chebyshevUtils.py. Many chebyshev polynomials are used to fit one moving object over a given timeperiod; typically, the length of each segment is typically about 2 days for MBAs. The start and end of each segment must match exactly, and the entire segments must fit into the total timespan an integer number of times. This is accomplished by setting n_decimal to the number of decimal places desired in the ‘time’ value. For faster moving objects, this number needs be greater to allow for smaller subdivisions. It’s tempting to allow flexibility to the point of not enforcing this for non-database use; however, then the resulting ephemeris may have multiple values depending on which polynomial segment was used to calculate the ephemeris. The length of each chebyshev polynomial is related to the number of ephemeris positions used to fit that polynomial by ngran: length = timestep * ngran The length of each polynomial is adjusted so that the residuals in RA/Dec position are less than sky_tolerance - default = 2.5mas. The polynomial length (and the resulting residuals) is affected by ngran (i.e. timestep).
Default values are based on Yusra AlSayaad’s work.
- Parameters:
- orbits_objOrbits
The orbits for which to fit chebyshev polynomial coefficients.
- t_startfloat
The starting point in time to fit coefficients. MJD.
- t_spanfloat
The time span (starting at t_start) over which to fit coefficients. Days.
- time_scale{‘TAI’, ‘UTC’, ‘TT’}
The timescale of the MJD time, t_start, and the time_scale that should be used with the chebyshev coefficients.
- obsCodeint, optional
The observatory code of the location for which to generate ephemerides. Default 807 (CTIO).
- sky_tolerancefloat, optional
The desired tolerance in mas between ephemerides calculated by OpenOrb and fitted values. Default 2.5 mas.
- nCoeff_positionint, optional
The number of Chebyshev coefficients to fit for the RA/Dec positions. Default 14.
- nCoeff_vmagint, optional
The number of Chebyshev coefficients to fit for the V magnitude values. Default 9.
- nCoeff_deltaint, optional
The number of Chebyshev coefficients to fit for the distance between Earth/Object. Default 5.
- nCoeff_elongationint, optional
The number of Chebyshev coefficients to fit for the solar elongation. Default 5.
- ngranint, optional
The number of ephemeris points within each Chebyshev polynomial segment. Default 64.
- eph_filestr, optional
The path to the JPL ephemeris file to use. Default is ‘$OORB_DATA/de405.dat’.
- n_decimalint, optional
The number of decimal places to allow in the segment length (and thus the times of the endpoints) can be limited to n_decimal places. Default 10. For LSST SIMS moving object database, this should be 13 decimal places for NEOs and 0 for all others.
Methods Summary
calc_one_segment
(orbit_obj, ephs)Calculate the coefficients for a single Chebyshev segment, for a single object.
calc_segment_length
([length])Set the typical initial ephemeris timestep and segment length for all objects between t_start/t_end.
Run the calculation of all segments over the entire time span.
generate_ephemerides
(times[, by_object])Generate ephemerides using OpenOrb for all orbits.
Using t_start and t_end, generate a numpy array containing times spaced at timestep = self.length/self.ngran.
write
(coeff_file, resid_file, failed_file[, ...])Write coefficients, residuals and failed fits to disk.
Methods Documentation
- calc_one_segment(orbit_obj, ephs)¶
Calculate the coefficients for a single Chebyshev segment, for a single object.
Calculates the coefficients and residuals, and saves this information to self.coeffs, self.resids, and (if there are problems), self.failed.
- Parameters:
- orbit_objOrbits
The single Orbits object we’re fitting at the moment.
- ephsnp.ndarray
The ephemerides we’re fitting at the moment (for the single object / single segment).
- calc_segment_length(length=None)¶
Set the typical initial ephemeris timestep and segment length for all objects between t_start/t_end.
Sets self.length.
The segment length will fit into the time period between t_start/t_end an approximately integer multiple of times, and will only have a given number of decimal places.
- Parameters:
- lengthfloat, optional
If specified, this value for the length is used, instead of calculating it here.
- calc_segments()¶
Run the calculation of all segments over the entire time span.
- generate_ephemerides(times, by_object=True)¶
Generate ephemerides using OpenOrb for all orbits.
- Parameters:
- timesnp.ndarray
The times to use for ephemeris generation.
- make_all_times()¶
Using t_start and t_end, generate a numpy array containing times spaced at timestep = self.length/self.ngran. The expected use for this time array would be to generate ephemerides at each timestep.
- Returns:
- np.ndarray
Numpy array of times.
- write(coeff_file, resid_file, failed_file, append=False)¶
Write coefficients, residuals and failed fits to disk.
- Parameters:
- coeff_filestr
The filename for the coefficient values.
- resid_filestr
The filename for the residual values.
- failed_filestr
The filename to write the failed fit information (if failed objects exist).
- appendbool, optional
Flag to append (or overwrite) the output files.