opsimsummary.summarize_opsim module¶
Class to summarize the OpSim output
-
class
opsimsummary.summarize_opsim.
SynOpSim
(pointings, opsimversion='lsstv3', raCol='ditheredRA', decCol='ditheredDec', angleUnit='degrees', indexCol='obsHistID', usePointingTree=False, subset='None')[source]¶ Bases:
object
Class with a summary of OpSim data base output.
Attributes: pointingTree
if self.usePointingTree is False, this is set to None. Otherewise
Methods
df_subset_columns
(df, subset)Return the dataframe df with only a subset of the columns as specified in the list subset fromOpSimDB
(dbname[, subset, opsimversion, …])Class Method to instantiate this from an OpSim sqlite database output which largely uses OpSimOutput.fromOpSimDB observedVisitsinRegion
([nside, nest, …])return a pd.DataFrame with the healpixelID=’hid’, ra and dec of the healpixels ‘hpix_ra’, ‘hpix_dec’ in radians, and count the number of visits for all healpixels that have visits satisfying minVisits <= count <= maxVisits . pointingsEnclosing
(ra, dec[, circRadius, …])Helper method returning a generator of pointings overlapping with circles of radius circRadius around a sequence of positions given in terms of `ra and dec. sampleRegion
([numFields, minVisits, nest, …])This method samples a number numFields fields provided they have a minimal number of visits minVisits -
static
df_subset_columns
(df, subset)[source]¶ Return the dataframe df with only a subset of the columns as specified in the list subset
Parameters: - df : pd.DataFrame
the input dataframe to be returned with subset of the columns
- subset: (list of strings| ‘all’)
if ‘all’, df is returned. Otherwise, return df[subset], with the same index.
- ..note: subset=[] returns only the index
-
classmethod
fromOpSimDB
(dbname, subset='combined', opsimversion='lsstv3', zeroDDFDithers=True, user_propIDs=None, dithercolumns=None, add_dithers=False, tableNames=('Summary', 'Proposal'), usePointingTree=False, **kwargs)[source]¶ Class Method to instantiate this from an OpSim sqlite database output which largely uses OpSimOutput.fromOpSimDB
Parameters: - dbname : string
absolute path to database file
- subset : string, optional, defaults to ‘combined’
one of {‘_all’, ‘unique_all’, ‘wfd’, ‘ddf’, ‘combined’} determines a sequence of propIDs for selecting observations appropriate for the OpSim database in use
- propIDs : sequence of integers, defaults to None
proposal ID values. If present, overrides the use of subset
- tableNames : tuple of strings, defaults to (‘Summary’, ‘Proposal’)
names of tables read from the OpSim database
- zeroDDFDithers : bool, defaults to True
if True, set dithers in DDF to 0, by setting ditheredRA, ditheredDec to fieldRA, fieldDec
- opsimversion: {‘lsstv3’|’sstf’|’lsstv4’}
version of OpSim corresponding to the output format.
- dithercolumns: `pd.DataFrame`, defaults to None
a pandas dataframe with the columns ditheredRA, ditheredDec and index obsHistID
- add_dithers : Bool, defaults to False
if add_dithers is True, the ditheredRA, ditheredDec columns will be removed and additional dithered columns either by dithercolumns or get_dithercolumns will be used.
-
observedVisitsinRegion
(nside=256, nest=True, minVisits=1, maxVisits=None, outFile=None, writeFile=False)[source]¶ return a pd.DataFrame with the healpixelID=’hid’, ra and dec of the healpixels ‘hpix_ra’, ‘hpix_dec’ in radians, and count the number of visits for all healpixels that have visits satisfying minVisits <= count <= maxVisits . This will also write out a csv outFile clobbering past version with this dataframe.
-
pointingTree
¶ if self.usePointingTree is False, this is set to None. Otherewise contains a PointingTree Object. This contains a BallTree of the pointings, and a method to find all pointings enclosed in a given radii.
-
pointingsEnclosing
(ra, dec, circRadius=0.0, pointingRadius=1.75, usePointingTree=None, transform=None, subset='all')[source]¶ Helper method returning a generator of pointings overlapping with circles of radius circRadius around a sequence of positions given in terms of `ra and dec. The calculation uses a Tree to make the calculations more efficient if usePointingTree is True, or uses direct calculations if this variable is set to False. A user may choose to obtain a subset of the pointing by supplying a subset in the form a list via the parameter subset.
Parameters: - ra : np.ndarray or a float, unit of degrees
a float or an array of floats representing the ra values
- dec : np.ndarray or a float, unit of degrees
a float or an array of floats representing the dec values
- circRadius: float, unit of degrees, defaults to 0.
a circle around each of the
- pointingRadius : degrees, defaults to 1.75
radius of the field of view
- usePointingTree: {None|True|False}, defaults to `None`
if None, usePointingTree = self.usePointingTree else the variable takes the {True|False} values assigned
- transform: function, Not implemented
- subset: (list of strings| ‘all’)
if ‘all’, df is returned. Otherwise, return df[subset], with the same index.
Returns: - A generator with the pointings that overlap with ra, dec
- .. note: 1. the values in the generator may be accessed by next(generator)
- subset=[] returns only the index
-
sampleRegion
(numFields=50000, minVisits=1, nest=True, nside=256, rng=<mtrand.RandomState object>, outfile=None, usePointingTree=True, subset='wfd', mwebv=0.0)[source]¶ This method samples a number numFields fields provided they have a minimal number of visits minVisits
Parameters: - numFields : int, mandatory
Number of fields to sample
- minVisits : int, number, defaults to 1
minimal number of visits required to consider the tile.
- nest : Bool, defaults to True
use the nest method rather than ring
- nside : int, defaults to 256
Healpix.NSIDE
- rng :
- outfile :
- usePointingTree : Bool, defaults to True
whether to use PointingTree or not
- subset : {‘wfd’|’ddf’|’combined’}
which subset to use.
-
class
opsimsummary.summarize_opsim.
PointingTree
(pointings, raCol='_ra', decCol='_dec', indexCol='obsHistID', leafSize=50)[source]¶ Bases:
object
Methods
pointingsEnclosing
(ra, dec, circRadius[, …])Parameters: validatePointings
(pointings, raCol, decCol)Validates pointings as having required properties according to list of tests below -
pointingsEnclosing
(ra, dec, circRadius, pointingRadius=1.75)[source]¶ Parameters: - ra : float or sequence, degrees
ra of the coordinates
- dec : float or sequence, degrees
dec of the coordinates
- circRadius : degrees, mandatory
radius of circle around point
- pointingRadius : degrees, defaults to 1.75
radius of the field of view
-
static
validatePointings
(pointings, raCol, decCol)[source]¶ Validates pointings as having required properties according to list of tests below
Parameters: - raCol : column name that should be in pointings
- decCol : column name that should be in pointings
- List of Tests:
- 1. raCol and decCol should be in the columns of `pointings`
-
-
opsimsummary.summarize_opsim.
add_simlibCols
(opsimtable, pixSize=0.2)[source]¶ Parameters: - opsimtable: `~pandas.DataFrame` object, mandatory
containing an opsim Output of version X. The main requirements here are that the columns ‘finSeeing’, ‘fiveSigmaDepth’, and ‘filtSkyBrightness’ are defined. If the opsim output has differently named variables or transformed variables, these should be changed to meet the criteria.
- pixSize: float, optional, defaults to LSST value of 0.2
pixel Size in units of arc seconds.
Returns: - DataFrame with additional columns of ‘simLibPsf’, ‘simLibZPTAVG’, and
- ‘simLibSkySig’
- .. note :: This was written from a piece of f77 code by David
Cinabro sent by email on May 26, 2015.