Self Calibration API

class rubin_sim.selfcal.BaseOffset(**kwargs)[source]

Bases: object

Base class for how to make offset classes

class rubin_sim.selfcal.LsqrSolver(observations, atol=1e-08, btol=1e-08, iter_lim=None, show=False)[source]

Bases: object

Class to solve self-calibration

Parameters:
  • observations (np.array) – A numpy array of the observations. Should have columns id, patch_id, observed_mag, mag_uncert.

  • atol (float) – Tolerance passed to lsqr.

  • btol (float) – Tolerance passed to lsqr.

  • iter_lim (int) – Iteration limit passed to lsqr.

  • show (bool) – Should the lsqr solver print some iteration logs (False).

clean_data()[source]

Remove observations that can’t contribute to a solution. Index remaining stars and patches so they are continuous.

return_solution()[source]
Returns:

patches, stars – Two arrays containing patch zeropoints and star best-fit mags.

Return type:

np.array, np.array

run()[source]

clean data, solve matrix, write solution out.

class rubin_sim.selfcal.NoOffset[source]

Bases: BaseOffset

class rubin_sim.selfcal.OffsetSNR(lsst_filter='r')[source]

Bases: BaseOffset

Generate offsets based on the 5-sigma limiting depth of an observation and the brightness of the star.

Note that this takes into account previous offsets that have been applied (so run this after things like vignetting).

rubin_sim.selfcal.assign_patches(stars, visit, n_patches=16, radius_fov=1.8)[source]

Assign PatchIDs to everything. Assume that stars have already been projected to x,y

rubin_sim.selfcal.generate_catalog(visits, stars_array, offsets=None, lsst_filter='r', n_patches=16, radius_fov=1.8, seed=42, uncert_floor=0.005, verbose=True)[source]

Generate a catalog of observed stellar magnitudes.

Parameters:
  • visits (np.array, (N,)) – A numpy array with the properties of the visits. Expected columns of fiveSigmaDepth, ra, dec, rotSkyPos (all degrees)

  • offsets (list of rubin_sim.selfcal.Offset classes) – A list of instatiated classes that will apply offsets to the stars

  • lsst_filter (str) – Which filter to use for the observed stars.

  • n_patches (int) – Number of patches to divide the FoV into. Must be an integer squared

  • radius_fov (float) – Radius of the telescope field of view in degrees

  • seed (float) – Random number seed

  • uncert_floor (float) – Value to add in quadrature to magnitude uncertainties (mags)

  • verbose (bool) – Should we be verbose

rubin_sim.selfcal.stars_project(stars, visit)[source]

Project the stars to x,y plane for a given visit.