uvotmisc¶
Convenience uvot grism fits header functions¶
get_curvatureCoef()
¶
-
uvotpy.uvotmisc.
get_curvatureCoef
(header, order=1)¶ retrieve the sigma coefficients from the FITS header
get_dispersion_from_header()
¶
-
uvotpy.uvotmisc.
get_dispersion_from_header
(header, order=1)¶ retrieve the dispersion coefficients from the FITS header
get_keyword_from_history()
¶
-
uvotpy.uvotmisc.
get_keyword_from_history
(hist, key)¶ Utility to get the keyword from the history list.
Parameters: hist : list
key : str
Returns: value belonging to key or None.
Notes
The history records are written while processing getSpec() and added to the FITS header of the output file.
These can be read from the header by just getting all the history records.
get_sigCoef()
¶
-
uvotpy.uvotmisc.
get_sigCoef
(header, order=1)¶ retrieve the sigma coefficients from the FITS header
time conversions¶
UT2swift()
¶
-
uvotpy.uvotmisc.
UT2swift
(year, month, day, hour, minute, second, millisecond, chatter=0)¶ Convert time in UT to swift time in seconds.
Parameters: year : int
e.g., 2012
month : str or int
e.g., ‘JAN’
day : int
e.g., 21
hour : int
minute : int
second : int
millisecond : int
Returns: swifttime : float
in seconds (see Heasarc for more conversions)
swtime2JD()
¶
-
uvotpy.uvotmisc.
swtime2JD
(TSTART, useFtool=False)¶ Time converter to JD from swift time
Returns: JD : float
Julian Date
MJD : float
Modified Julian Date
gregorian : str
normal date and time
outdate : datetime
python datetime object
Notes
example (input TSTART as a string) for 2001-01-01T00:00:00.000
TSTART=0.000 MJD= 51910.00000000 JD=2451910.5
reading ascii tables¶
rdList()
¶
-
uvotpy.uvotmisc.
rdList
(file, symb=' ', chatter=0, line1=None, line2=None, skip='#')¶ Put data in list: chatter>4 gives detailed output restrict lines in file with line1, line2 skip lines with the skip char in first position
Parameters: file : str
file name ascii table
symb : str
character used to split out the columns
line1,line2 : int
sub-select records[line1:line2]
chatter : int
Returns: table : ndarray
a table of values
Notes
The table must have equal length columns and the same number of fields on each row/record.
Use rdTab to read a table with numerical only data
rdTab()
¶
-
uvotpy.uvotmisc.
rdTab
(file, symb=' ', commentsymb='#', get_comments=False)¶ RdTab will read in a table of numerical values provided every record has the same number of fields. Comment lines start by default with a hash mark, but that can be changed by passing another symbol in commentsymb comments in data records are not supported.
Parameters: file : str
file name ascii table
symb : str
character used to separate the columns
commentsymb : str
character used in first position of line for comments
get_comments : bool
if True, return comments only
Returns: table : ndarray
a table of values
Notes
The table must have equal length columns with only numbers.
Use rdList to read a table with character data
NPMK (MSSL) 2010
other functions¶
uvotrotvec()
¶
-
uvotpy.uvotmisc.
uvotrotvec
(X, Y, theta)¶ rotate vectors X, Y over angle theta (deg) with origen [0,0]
Parameters: X, Y : arrays
coordinates
theta : float
angle in degrees
Returns: rx,ry : arrays
rotated coordinates
encircled_energy()
¶
-
uvotpy.uvotmisc.
encircled_energy
(uvotfilter, areapix)¶ Compute the encircled energy in a uvotfilter as compared that in the default 5” radius.
Parameters: uvotfilter : one of [“wh”,”v”,”b”,”u”,”uvw1”,”uvm2”,”uvw2”]
filer name
areapix : float
constant describing the number of sub-pixels for computing the cps rate
Notes
This applies solely for point sources.
polyfit_with_fixed_points()
¶
-
uvotpy.uvotmisc.
polyfit_with_fixed_points
(n, x, y, xf, yf)¶ compute a polynomial fit with fixed points
Parameters: n : int
order of polynomial
x,y : array like
data point coordinates
xf,yf : array like
fixed data point coordinates