mica.archive.aca_dark
¶
mica.archive.aca_dark.dark_cal
¶
- mica.archive.aca_dark.dark_cal.dark_id_to_date(dark_id)[source]¶
Convert
dark_id
(YYYYDOY) to the corresponding CxoTime ‘date’ format.- Parameters:
date – dark id (YYYYDOY)
- Returns:
str in CxoTime ‘date’ format
- mica.archive.aca_dark.dark_cal.date_to_dark_id(date)[source]¶
Convert
date
to the corresponding YYYYDOY format for a dark cal identifiers.- Parameters:
date – any CxoTime compatible format
- Returns:
dark id (YYYYDOY)
- mica.archive.aca_dark.dark_cal.get_dark_cal_dirs(dark_cals_dir='/proj/sot/ska/data/mica/archive/aca_dark')[source]¶
Get an ordered dict of directory paths containing dark current calibration files.
The key is the dark cal identifier (YYYYDOY) and the value is the path.
- Parameters:
dark_cals_dir – directory containing dark cals.
- Returns:
ordered dict of absolute directory paths
- mica.archive.aca_dark.dark_cal.get_dark_cal_id(date, select='before', dark_cal_ids=None)[source]¶
Return the dark calibration id corresponding to
date
.If
select
is'before'
(default) then use the first calibration which occurs beforedate
. Other valid options are'after'
and'nearest'
.- Parameters:
date – date in any CxoTime format
select – method to select dark cal (before|nearest|after)
dark_cal_ids – list of all dark-cal IDs (optional, the output of get_dark_cal_ids)
- Returns:
dark cal id string (YYYYDOY)
- mica.archive.aca_dark.dark_cal.get_dark_cal_ids(dark_cals_dir='/proj/sot/ska/data/mica/archive/aca_dark')[source]¶
Get an ordered dict dates as keys and dark cal identifiers (YYYYDOY) as values.
- Parameters:
dark_cals_dir – directory containing dark cals.
- Returns:
ordered dict of absolute directory paths
- mica.archive.aca_dark.dark_cal.get_dark_cal_image(date, select='before', t_ccd_ref=None, aca_image=False, allow_negative=False)[source]¶
Return the dark calibration image (e-/s) nearest to
date
.If
select
is'before'
(default) then use the first calibration which occurs beforedate
. Other valid options are'after'
and'nearest'
.- Parameters:
date – date in any CxoTime format
select – method to select dark cal (before|nearest|after)
t_ccd_ref – rescale dark map to temperature (degC, default=no scaling)
aca_image – return an ACAImage instance instead of ndarray
allow_negative – allow negative values in raw dark map (default=False)
- Returns:
1024 x 1024 ndarray with dark cal image in e-/s
- mica.archive.aca_dark.dark_cal.get_dark_cal_props(date, select='before', include_image=False, t_ccd_ref=None, aca_image=False, allow_negative=False)[source]¶
Return a dark calibration properties structure for
date
If
select
is'before'
(default) then use the first calibration which occurs beforedate
. Other valid options are'after'
and'nearest'
.If
include_image
is True then an additional column or keyimage
is defined which contains the corresponding 1024x1024 dark cal image.- Parameters:
date – date in any CxoTime format
select – method to select dark cal (before|nearest|after)
include_image – include the dark cal images in output (default=False)
t_ccd_ref – rescale dark map to temperature (degC, default=no scaling)
aca_image – return an ACAImage instance instead of ndarray
allow_negative – allow negative values in raw dark map (default=False)
- Returns:
dict of dark calibration properties
- mica.archive.aca_dark.dark_cal.get_dark_cal_props_table(start=None, stop=None, include_image=False, as_table=True)[source]¶
Return a table of dark calibration properties between
start
andstop
.If
include_image
is True then an additional column or keyimage
is defined which contains the corresponding 1024x1024 dark cal image.If
as_table
is True (default) then the result is an astropy Table object. If False then a list of dicts is returned. In this case the full contents of the properties file including replica properties is available.- Parameters:
start – start time (default=beginning of mission)
stop – stop time (default=now)
include_image – include the dark cal images in output (default=False)
as_table – return a Table instead of a list (default=True)
- Returns:
astropy Table or list of dark calibration properties
mica.archive.aca_hdr3
¶
Experimental/alpha code to work with ACA L0 Header 3 data
- class mica.archive.aca_hdr3.MSID(msid, start, stop, msid_data=None, filter_bad=False)[source]¶
ACA header 3 data object.
ACA header 3 data object to work with header 3 data from available 8x8 ACA L0 telemetry:
>>> from mica.archive import aca_hdr3 >>> ccd_temp = aca_hdr3.MSID('ccd_temp', '2012:001', '2012:020') >>> type(ccd_temp.vals) 'numpy.ma.core.MaskedArray'
When given an
msid
andstart
andstop
range, the object will query the ACA L0 archive to populate the object, which includes the MSID values (vals
) at the given times (times
).The parameter
msid_data
is used to create an MSID object from the data of another MSID object.When
filter_bad
is supplied then only valid data values are stored and thevals
andtimes
attributes are np.ndarray instead of ma.MaskedArray.- Parameters:
msid – MSID name
start – Chandra.Time compatible start time
stop – Chandra.Time compatible stop time
msid_data – data dictionary or object from another MSID object
filter_bad – remove missing values
- class mica.archive.aca_hdr3.MSIDset(msids, start, stop)[source]¶
ACA header 3 data object
ACA header 3 data object to work with header 3 data from available 8x8 ACA L0 telemetry. An MSIDset works with multiple MSIDs simultaneously.
>>> from mica.archive import aca_hdr3 >>> perigee_data = aca_hdr3.MSIDset(['ccd_temp', 'aca_temp', 'dac'], ... '2012:001', '2012:030')
- Parameters:
msids – list of MSIDs
start – Chandra.Time compatible start time
stop – Chandra.Time compatible stop time
mica.archive.aca_l0
¶
Functions¶
- mica.archive.aca_l0.get_slot_data(start, stop, slot, imgsize=None, db=None, data_root=None, columns=None, centered_8x8=False)[source]¶
Get slot data.
For a the given parameters, retrieve telemetry and construct a masked array of the MSIDs available in that telemetry.
>>> from mica.archive import aca_l0 >>> slot_data = aca_l0.get_slot_data('2012:001', '2012:002', slot=7) >>> temp_ccd_8x8 = aca_l0.get_slot_data('2005:001', '2005:010', ... slot=6, imgsize=[8], ... columns=['TIME', 'TEMPCCD'])
- Parameters:
start – start time of requested interval
stop – stop time of requested interval
slot – slot number integer (in the range 0 -> 7)
imgsize – list of integers of desired image sizes (defaults to all -> [4, 6, 8])
db – handle to archive lookup table
data_root – parent directory that contains archfiles.db3 (for use when db handle not available)
columns – list of desired columns in the ACA0 telemetry (defaults to all in 8x8 telemetry)
centered_8x8 – boolean flag to reshape the IMGRAW field to (-1, 8, 8) (defaults to False)
- Returns:
data structure for slot
- Return type:
numpy masked recarray
- mica.archive.aca_l0.get_files(obsid=None, start=None, stop=None, slots=None, imgsize=None, db=None, data_root=None)[source]¶
Get list of ACA0 files.
Retrieve list of files from ACA0 archive lookup table that match arguments. The database query returns files with
tstart < stop and tstop > start
which returns all files that contain any part of the interval between start and stop. If the obsid argument is provided, the archived obspar tstart/tstop (sybase aca.obspar table) are used.
>>> from mica.archive import aca_l0 >>> obsid_files = aca_l0.get_files(obsid=5438) >>> time_files = aca_l0.get_files(start='2012:001', stop='2012:002') >>> time_8x8 = aca_l0.get_files(start='2011:001', stop='2011:010', ... imgsize=[8])
- Parameters:
obsid – obsid
start – start time of requested interval
stop – stop time of requested interval
slots – list of integers of desired image slots to retrieve (defaults to all -> [0, 1, 2, 3, 4, 5, 6, 7, 8])
imgsize – list of integers of desired image sizes (defaults to all -> [4, 6, 8])
db – handle to archive lookup table
data_root – parent directory of Ska aca l0 archive
- Returns:
interval files
- Return type:
list
- mica.archive.aca_l0.get_l0_images(start, stop, slot, imgsize=None, columns=None)[source]¶
Get ACA L0 Images.
Get ACA L0 images for the given
start
andstop
times and the givenslot
. Optionally filter on image size viaimgsize
or change the default image metadata viacolumns
.>>> from mica.archive import aca_l0 >>> imgs = aca_l0.get_l0_images('2012:001', '2012:002', slot=7) >>> imgs = aca_l0.get_l0_images('2005:001', '2005:002', slot=6, imgsize=[8])
The default columns are: [‘TIME’, ‘IMGROW0’, ‘IMGCOL0’, ‘BGDAVG’, ‘IMGSTAT’, ‘IMGFUNC1’, ‘IMGSIZE’, ‘IMGSCALE’, ‘INTEG’]
The image pixel values are given in units of DN. One can convert to e-/sec by multiplying by (5 / INTEG).
- Parameters:
start – start time of requested interval
stop – stop time of requested interval
slot – slot number integer (in the range 0 -> 7)
imgsize – list of integers of desired image sizes (default=[4, 6, 8])
columns – image meta-data columns
- Returns:
list of ACAImage objects
mica.archive.asp_l1
¶
Update aspect archive L1 products.
Script to update Ska file archive aspect L1 products. Module also provides methods to retrieve the directory (or directories) for an obsid.
This uses the obsid_archive module with a configuration specific to the aspect L1 products.
Functions¶
- mica.archive.asp_l1.get_files(obsid=None, start=None, stop=None, revision=None, content=None)[source]¶
List asp_l1 files for an obsid or a time range.
>>> from mica.archive import asp_l1 >>> obs_files = asp_l1.get_files(6000) >>> obs_gspr = asp_l1.get_files(6000, content=['GSPROPS']) >>> range_fidpr = asp_l1.get_files(start='2012:001', ... stop='2012:030', ... content=['FIDPROPS'])
The available content types are: ASPQUAL, ASPSOL, ASPSOLOBI, ACACAL, ACA_BADPIX, FIDPROPS, GYROCAL, GSPROPS, and ACACENT.
- Parameters:
obsid – obsid
start – time range start (Chandra.Time compatible)
stop – time range stop (Chandra.Time compatible)
revision – revision integer or ‘last’ defaults to current released version
content – archive CONTENT type defaults to all available ASP1 types
- Returns:
full path of files matching query
- mica.archive.asp_l1.get_dir(obsid)[source]¶
Get ASP L1 directory for default/released products for an obsid.
>>> from mica.archive import asp_l1 >>> asp_l1.get_dir(2121) '/proj/sot/ska/data/mica/archive/asp1/02/02121'
- Parameters:
obsid – obsid
- Returns:
directory
- Return type:
string
- mica.archive.asp_l1.get_obs_dirs(obsid)[source]¶
Get all ASP L1 directories for an obsid in the Ska file archive.
>>> from mica.archive import asp_l1 >>> obsdirs = asp_l1.get_obs_dirs(6000)
obsdirs will look something like:
{'default': '/proj/sot/ska/data/mica/archive/asp1/06/06000', 2: '/proj/sot/ska/data/mica/archive/asp1/06/06000_v02', 3: '/proj/sot/ska/data/mica/archive/asp1/06/06000_v03', 'last': '/proj/sot/ska/data/mica/archive/asp1/06/06000', 'revisions': [2, 3]}
- Parameters:
obsid – obsid
- Returns:
map of obsid version to directories
- Return type:
dictionary
- mica.archive.asp_l1.get_atts(obsid=None, start=None, stop=None, revision=None, filter=True)[source]¶
Get ground aspect attitudes
Get the ground aspect solution quaternions and times covering obsid or start to stop, in the ACA frame.
- Obsid:
obsid
- Start:
start time (DateTime compat)
- Stop:
stop time (DateTime compat)
- Revision:
aspect pipeline processing revision (integer version, None, or ‘last’)
- Filter:
boolean, true means returned values will not include quaternions during times when asp_sol_status is non-zero
- Returns:
Nx4 np.array of quaternions, np.array of N times, list of dict with header from each asol file.
- mica.archive.asp_l1.get_atts_from_files(asol_files, acal_files, aqual_files, filter=True)[source]¶
Get ground aspect attitudes from ASP1 source files.
From ASP1 source files (asol, acal, aqual) get the ground aspect solution quaternions and times covering the range of asol_files in the ACA frame. The asol, acl, and aqual files are assumed to have one-to-one correspondence (though the asol to acal times are checked).
- Asol_files:
list of aspect asol1 files
- Acal_files:
list of acal1 files associated with asol_files
- Aqual_files:
list of aqual files associated with asol_files
- Filter:
boolean, true means returned values will not include quaternions during times when asp_sol_status is non-zero
- Returns:
Nx4 np.array of quaternions, np.array of N times, list of dict with header from each asol file.
mica.archive.obsid_archive
¶
Base Class used in mica.archive.asp_l1 and mica.archive.obspar
Generalized module for fetching and archiving obsid-organized telemetry.
- class mica.archive.obsid_archive.ObsArchive(config)[source]¶
Obsid Archive Class.
Object to store configuration, logging, and processing tasks to fetch obsid telemetry from the CXC archive and store in a Ska file archive, while logging the archive files to a file lookup database.
The configuration dictionary
config
may have these key/values:- data_root: directory for products
(example /proj/sot/ska/data/mica/archive/asp1)
- temp_root: directory for temporary storage of fetched
telemetry
- bad_obsids: file containing list of obsids that should be
ignored when in regular update mode
cols: headers that will be included in file lookup table
sql_def: sql file to build file lookup archfiles table
- apstat_table: axafapstat database table from which to find
new processing (by id)
- apstat_id: field in apstat_table to use as unique CXCDS
processing id
label: label of product type for log messages
- small: arc5gl keyword/filetype for small file from products
(example asp1{fidprops}). This will be retrieved with “get %s” % config[‘small’] and the retrieved files will be used to determine product version.
- small_glob: glob to match files retrieved by
“get %s” % config[small] (example ‘fidpr’)
- small_ver_regex: regular expression to search for version from
retrieved files (example ‘pcadfd+N(d{3})_’)
full: arc5gl keyword for products (example ‘asp1’)
- rebuild: If True/set, allow update mode to rebuild the database
from obsid 1.
- Parameters:
config – configuration dictionary
- Returns:
ObsArchive instance
- get_all_obspar_info(i, f, archfiles)[source]¶
Put together an obspar dictionary.
Read obspar and add ‘obsid’ and ‘filename’ keys to the dictionary i and archfiles are just passed to make the logging prettier.
- get_arch(obsid, version='last')[source]¶
Get CXC archive information for obsid.
Retrieve telemetry for an observation from the CXC archive and store in the Ska file archive.
- Parameters:
obsid – obsid
version – ‘default’, ‘last’, or revision/version number
- Returns:
obsid directory in Ska file archive
- Return type:
directory string
- get_arch_info(i, f, archfiles)[source]¶
Get information for a file for the file lookup table/database.
For obspars, call the get_obspar_info() method. For FITS files, call get_fits_info() method.
- get_dir(obsid)[source]¶
Return the latest released directory for an obsid
Return None if there are no ‘default’ / released products.
- static get_file_ver(tempdir, fileglob, ver_regex)[source]¶
Get file version/revision.
Determine the version/revision of a set of archived files from their file names.
- Parameters:
tempdir – directory containing files
fileglob – glob to match files in question
ver_regex – regular expression to pull out version from the set of files
- Returns:
version number
- Return type:
integer
- get_fits_info(i, f, archfiles)[source]¶
Read header fits details.
Read FITS file
f
with indexi
(position within list of filenamesarchfiles
) and get dictionary of values to store in file lookup database. This values include all header key/value pairs with keys inconfig[cols]
plus the header checksum, the filename, the year, and day-of-year.- Parameters:
i – index of file f within list of files archfiles
f – filename
archfiles – list of filenames for this batch
- Returns:
info for a file
- Return type:
dictionary
- get_obs_dirs(obsid)[source]¶
Return a dictionary of the directories available for an obsid.
This is just done with a glob in the data directories.
- get_obspar_info(i, f, archfiles)[source]¶
Wrap get_all_obspar_info() and just include columns in config[‘cols’]
- get_todo_from_links(archive_dir)[source]¶
Get list of directories “left to do”.
Return a list of all of the *_last directories in the file archive (and specify revision=default to attempt to get new released products for them).
- get_ver_num(obsid, version='default')[source]¶
Get version number.
Determine the version number associated with the current released products or with the products referenced by “version=last”.
- Parameters:
obsid – obsid
version – version string (‘default’|’last’)
- Returns:
version
- Return type:
integer
- set_env()[source]¶
Set environment included an arc5gl handle and and a handle to the axafapstat database
- set_read_env()[source]¶
Set environment included an arc5gl handle and and a handle to the axafapstat database
- update_link(obsid)[source]¶
Make and update obsdir links.
Create links in the obsid data directories to make it easy to find the current ‘default’/released data, all versions that have been archived, and the ‘last’/unreleased/provisional data if available.
This is designed so that if obsid 5 has released data in version 1 and provisional data in version 2, that the directories and links will look like:
directory 00005_v01 directory 00005_v02 link 00005 -> 00005_v01 link 00005_last -> 00005_v02
mica.archive.obspar
¶
Script to update Ska file archive obspars.
Module also provides methods to retrieve the directory (or directories) for an obsid.
This uses the obsid_archive module with a configuration specific to the obspar products.
Functions¶
- mica.archive.obspar.get_dir(obsid)[source]¶
Get obspar directory for default/released products for an obsid.
>>> from mica.archive import obspar >>> obspar.get_dir(2121) '/proj/sot/ska/data/mica/archive/obspar/02/02121'
- Parameters:
obsid – obsid
- Returns:
directory
- Return type:
string
- mica.archive.obspar.get_obs_dirs(obsid)[source]¶
Get all obspar directories for an obsid in the Ska file archive.
>>> from mica.archive import obspar >>> obsdirs = obspar.get_obs_dirs(6000)
obsdirs will look something like:
{'default': '/proj/sot/ska/data/mica/archive/obspar/06/06000', 2: '/proj/sot/ska/data/mica/archive/obspar/06/06000_v02', 3: '/proj/sot/ska/data/mica/archive/obspar/06/06000_v03', 'last': '/proj/sot/ska/data/mica/archive/obspar/06/06000', 'revisions': [2, 3]}
- Parameters:
obsid – obsid
- Returns:
map of obsid version to directories
- Return type:
dictionary
mica.archive.cda.services
¶
Python Chandra Data Archive (CDA) interface.
Python interface to the Chandra Data Archive (CDA) web services and an interface to a local disk copy of the Observation Catalog (Ocat).
- mica.archive.cda.services.get_archive_file_list(obsid, detector, level, dataset='flight', **params)[source]¶
Get list of archive files for given
obsid
,detector
,level
, anddataset
.Other parameters can be
subdetector
,filetype
,filename
, andobi
.Note: this may not be working for level 0 products.
Examples:
>>> get_archive_file_list(obsid=2365, detector='pcad', ... subdetector='aca', level=1, obi=2) <Table length=27> Filename Filesize Timestamp str30 int64 str19 ------------------------------ -------- ------------------- pcadf126690624N007_asol1.fits 7300800 2021-04-09 08:04:29 pcadf02365_002N001_asol1.fits 4728960 2021-04-09 08:04:30 ... ... ... pcadf126695890N007_adat61.fits 1293120 2021-04-09 08:04:28 pcadf126695890N007_adat71.fits 1293120 2021-04-09 08:04:28 >>> get_archive_file_list(obsid=400, detector='acis', level=2, filetype='evt2') <Table length=1> Filename Filesize Timestamp str24 int64 str19 ------------------------ -------- ------------------- acisf00400N007_evt2.fits 4619520 2011-07-08 13:52:57
- Parameters:
obsid – int, str Observation ID
detector – str Detector name (e.g. ‘pcad’, ‘acis’)
level – int, float, str Level name (e.g. 0, 0.5, 1, 1.5, 2, 3)
dataset – str Dataset name (default=’flight’)
**params –
dict Additional parameters to filter query (subdetector, filetype, obi, filename)
- Returns:
astropy Table Table of archive files
- mica.archive.cda.services.get_ocat_local(obsid=None, *, target_name=None, resolve_name=False, ra=None, dec=None, radius=1.0, return_type='auto', datafile=None, where=None, **params)[source]¶
Get Ocat target table from a local HDF5 data file.
The local data file is assumed to be an HDF5 file that contains a copy of the Ocat details, typically updated by a cron job running on HEAD and (if necessary) synced to the local host.
If
return_type='auto'
the return type is determined by the rules:If
obsid
is provided AND the obsid corresponds to an integer AND the returned result has a single row THEN the return type isdict
ELSE the return tuple is aTable
.
If
return_type='table'
then always return aTable
.- Parameters:
obsid – int, optional Observation ID
target_name – str, optional Target name, used in SkyCoord.from_name() to define
ra
anddec
ifresolve_name
is True, otherwise matches a substring of the table columntarget_name
(ignoring spaces).resolve_name – bool, optional If True, use
target_name
to resolvera
anddec
.ra – float, optional Right Ascension in decimal degrees
dec – float, optional Declination in decimal degrees
radius – float, optional Search radius in arcmin (default=1.0)
datafile – str, optional HDF5 Ocat target table data file. Defaults to MICA_ARCHIVE/ocat_target_table.h5
where – str Filter string to pass to tables read_where() to limit returned results. See https://www.pytables.org/usersguide/condition_syntax.html
**params –
dict Additional filter criteria as
<colname> == <value>
key/value pairs.
- Returns:
astropy Table or dict of Ocat details
- mica.archive.cda.services.get_ocat_web(obsid=None, *, summary=False, target_name=None, resolve_name=False, ra=None, dec=None, radius=1.0, return_type='auto', timeout=60, **params)[source]¶
Get the Ocat target table data from Chandra Data Archive web services.
If
return_type='auto'
the return type is determined by the rules:If
obsid
is provided AND the obsid corresponds to an integer AND the returned result has a single row THEN the return type isdict
ELSE the return tuple is aTable
.
If
return_type='table'
then always return aTable
.Additional function args for CDA search parameters:
instrument=ACIS,ACIS-I,ACIS-S,HRC,HRC-I,HRC-S grating=NONE,LETG,HETG type=ER,TOO,CAL,GO,GTO,DDT cycle=00,01,02,03,04, ... category=SOLAR SYSTEM, NORMAL GALAXIES, STARS AND WD, WD BINARIES AND CV, BH AND NS BINARIES, NORMAL GALAXIES CLUSTERS OF GALAXIES, ACTIVE GALAXIES AND QUASARS, GALACTIC DIFFUSE EMISSION AND SURVEYS, EXTRAGALACTIC DIFFUSE EMISSION AND SURVEYS jointObservation= HST,XMM,Spitzer,NOAO,NRAO,NuSTAR,Suzaku,Swift,RXTE status= archived,observed,scheduled, unobserved,untriggered,canceled,deleted expMode= ACIS TE,ACIS CC,HRC Timing grid = 'is not null' or 'is null'
Input coordinate specifications:
inputCoordFrame=J2000 (other options: b1950, bxxxx, ec1950, ecxxxx, galactic) inputCoordEquinox=2000 (4 digit year)
These parameters are single text entries:
target: matches any part of target name piName: matches any part of PI name observer: matches any part of observer name propNum: proposal number propTitle: matches any part of proposal title
These parameters form a cone search; if you use one you should use them all:
lon lat radius (arcmin, default=1.0)
These parameters form a box search; one lon & one lat are required. Open-ended ranges are allowed. (Such as lonMin=15 with no lonMax.)
lonMin lonMax latMin latMax
These parameters are range lists, where the range is indicated by a hyphen (-). Multiple ranges can be entered separated by commas:
obsid (eg. obsid=100,200-300,600-1000,1800) seqNum expTime appExpTime countRate
These parameters are date range lists, where the range is indicated by a hyphen (/). Multiple ranges can be entered separated by commas. Valid dates are in one of the following formats: YYYY-MM-DD, YYYY-MM-DD hh:mm, or YYYY-MM-DD hh:mm:ss
startDate releaseDate
These specify how the data is displayed and ordered:
outputCoordFrame=J2000 (other options: b1950, bxxxx, ec1950, ecxxxx, galactic) outputCoordEquinox=2000 (4 digit year) outputCoordUnits=decimal (other option: sexagesimal) sortColumn=ra (other options: dec,seqNum,instrument,grating, appExpTime,expTime, target,piName,observer,status, startDate,releaseDate, obsid,propNum,category,type,cycle) sortOrder=ascending (other option: descending) maxResults=# (the number of results after which to stop displaying)
Special parameters that change the output table contents are available for full output (
summary=False
): -acisWindows='true'
: return ACIS windows details for a single obsid -rollReqs='true'
: return roll requirements for a single obsid -timeReqs='true'
: return time requirements for a single obsid- Parameters:
obsid – int, str Observation ID or string with ObsId range or list of ObsIds
summary – bool Return summary data (26 columns) instead of full data (124 columns)
target_name – str, optional Target name, used in SkyCoord.from_name() to define
ra
anddec
ifresolve_name
is True, otherwise matches a substring of the table columntarget_name
(ignoring spaces).resolve_name – bool, optional If True, use
target_name
to resolvera
anddec
.ra – float, optional Right Ascension in decimal degrees
dec – float, optional Declination in decimal degrees
radius – float, optional Search radius in arcmin (default=1.0)
timeout – int, float Timeout in seconds for the request (default=60)
return_type – str Return type (default=’auto’ => Table or dict)
**params –
dict Parameters passed to CDA web service
- Returns:
astropy Table or dict of the observation details
- mica.archive.cda.services.get_proposal_abstract(obsid=None, propnum=None, timeout=60)[source]¶
Get a proposal abstract from the CDA services.
One of
obsid
orpropnum
must be provided.- Parameters:
obsid – int, str Observation ID
propnum – str Proposal number, including leading zeros e.g. ‘08900073’
timeout – int, float Timeout in seconds for the request
- Returns:
dict Dictionary of proposal abstract
mica.bad_obsids
¶
Functions¶
- mica.bad_obsids.bad_obsids()[source]¶
Return bad obsid list
Returns a list of the obsids that are reasonable to exclude from most trending applications. The list includes observations of Venus and observations with multiple obis. The observations of Venus are problematic for star trending. The observations with multiple obis may have more than one attitude for the same obsid.
The lists of each (venus, multi_obi, weird) are maintained directly in the module and may be used directly if needed.
- Returns:
list
mica.vv
¶
Functions¶
- mica.vv.get_vv(obsid, version='default')[source]¶
Retrieve V&V data for an obsid/version.
This reads the saved JSON and returns the previously- calculated V&V data.
- Parameters:
obsid – obsid
version – ‘last’, ‘default’, or version number
- Returns:
dict of V&V data
- mica.vv.get_vv_dir(obsid, version='default')[source]¶
Get directory containing V&V products.
Get directory containing V&V products for a requested obsid/version, including plots and json.
- Parameters:
obsid – obsid
version – ‘last’, ‘default’ or version number
- Returns:
directory name for obsid/version
- mica.vv.get_vv_files(obsid, version='default')[source]¶
Get list of V&V files available for a requested obsid/version.
- Parameters:
obsid – obsid
version – ‘default’, ‘last’ or version number
- Returns:
list of files
- mica.vv.get_rms_data()[source]¶
Retrieve/return all data from RMS trending H5 archive
- Returns:
numpy array of RMS data for each star/obsid/version
- mica.vv.get_arch_vv(obsid, version='last')[source]¶
Retrieve and load archived V&V.
Given obsid and version, find archived ASP1 and obspar products and run V&V. Effort is made to find the obspar that was actually used during creation of the ASP1 products.
- Parameters:
obsid – obsid
version – ‘last’, ‘default’, or revision number of ASP1 products
- Returns:
mica.vv.Obi V&V object
mica.utils
¶
Functions¶
mica.starcheck
¶
Functions¶
- mica.starcheck.get_starcheck_catalog(obsid, mp_dir=None, starcheck_db=None)[source]¶
Get starcheck catalog dictionary.
For a given obsid, return a dictionary describing the starcheck catalog that should apply. The content of that dictionary is from the database tables of that parsed the starcheck report and has keys:
cat: catalog rows as astropy.table
manvr: list of maneuvers to this attitude
pred_temp: predicted ACA CCD temperature
warnings: list of warnings below catalog in starcheck output
obs: dictionary of observation target and pointing information
mp_dir: directory with products that are the source of this catalog data
status: string describing status of that observation, described below.
Status:
ran: observation approved and has date before current time
approved: observation approved and has date after current time
ran_pre_commands: ran, but before commands archive starts
- Parameters:
obsid – obsid
mp_dir – optional load specifier like ‘FEB1317A’ or ‘/2017/FEB1317/oflsa/’. By default the as-run loads (via
get_mp_dir()
) are used.starcheck_db – optional handle to already-open starcheck database
- Returns:
dictionary with starcheck content described above
- mica.starcheck.get_starcheck_catalog_at_date(date, starcheck_db=None)[source]¶
Get starcheck catalog dictionary at date.
For a given date, return a dictionary describing the starcheck catalog that should apply. The content of that dictionary is from the database tables that parsed the starcheck report. A catalog is defined as applying, in this function, to any time from the end of the previous dwell through the end of the dwell in which the catalog was used.
Star catalog dictionary with keys:
cat: catalog rows as astropy.table
manvr: list of maneuvers to this attitude
pred_temp: predicted ACA CCD temperature
warnings: list of warnings below catalog in starcheck output
obs: dictionary of observation target and pointing information
mp_dir: directory with products that are the source of this catalog data
status: string describing status of that observation, described below.
Status:
ran: observation was observed
approved: observation in an approved future schedule
- Parameters:
date – Chandra.Time compatible date
starcheck_db – optional handle to already-open starcheck database
- Returns:
dictionary with starcheck content described above
- mica.starcheck.get_mp_dir(obsid, starcheck_db=None)[source]¶
Get mission planning directory for obsid.
Get the mission planning directory for an obsid and some status information. If the obsid catalog was used more than once (multi-obi or rescheduled after being used in a vehicle-only interval), return the directory and details of the last one used on the spacecraft.
Only observations from approved schedules are considered.
The returned
directory
is a string like “/2006/DEC2506/oflsc/” that describes the directory that was used for the products with this star catalog.The returned
status
has possible values:“ran”: observation date before current time
“approved”: observation date after current time
“no starcat”: observation exists but has no star catalog
The return
date
is the date/time of theMP_STARCAT
time.- Parameters:
obsid – obsid
starcheck_db – optional handle to already-open starcheck database
- Returns:
directory, status, date
- mica.starcheck.get_monitor_windows(start=None, stop=None, min_obsid=40000, config=None)[source]¶
Use the database of starcheck products to get a list of monitor windows.
This includes only catalogs that ran or will run.
NOTE: by default only monitor windows in ER’s are included, set
min_obsid=0
to change this.- Parameters:
start – Optional start time for filtering windows as fetched from the database
stop – Optional stop time for filtering windows as fetched from the database
min_obsid – Minimum obsid value for filtering. Default of 40000 is intended to fetch only ERs
config – config dictionary. If supplied must include ‘starcheck_db’ key with a dictionary of the required arguments to ska_dbi to connect to that database.
- Returns:
astropy Table of monitor windows. See get_starcheck_catalog_at_date for description of the values of the ‘status’ column. The ‘catalog’ column contains the get_starcheck_catalog_at_date returned dictionary.