INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Runs the Box Least Squares Fitting Search for transit - shaped signals. | def bls_parallel_pfind(
times, mags, errs,
magsarefluxes=False,
startp=0.1, # by default, search from 0.1 d to...
endp=100.0, # ... 100.0 d -- don't search full timebase
stepsize=1.0e-4,
mintransitduration=0.01, # minimum transit length in phase
maxtransitdurat... |
This parses a CSV header from a K2 CSV LC. | def _parse_csv_header(header):
'''This parses a CSV header from a K2 CSV LC.
Returns a dict that can be used to update an existing lcdict with the
relevant metadata info needed to form a full LC.
'''
# first, break into lines
headerlines = header.split('\n')
headerlines = [x.lstrip('# ') ... |
This reads in a K2 lightcurve in CSV format. Transparently reads gzipped files. | def read_csv_lightcurve(lcfile):
'''
This reads in a K2 lightcurve in CSV format. Transparently reads gzipped
files.
Parameters
----------
lcfile : str
The light curve file to read.
Returns
-------
dict
Returns an lcdict.
'''
# read in the file first
... |
This runs the functions from: py: func: astrobase. varclass. starfeatures on a single light curve file. | def get_starfeatures(lcfile,
outdir,
kdtree,
objlist,
lcflist,
neighbor_radius_arcsec,
deredden=True,
custom_bandpasses=None,
lcformat='hat-sql',
... |
This wraps starfeatures. | def _starfeatures_worker(task):
'''
This wraps starfeatures.
'''
try:
(lcfile, outdir, kdtree, objlist,
lcflist, neighbor_radius_arcsec,
deredden, custom_bandpasses, lcformat, lcformatdir) = task
return get_starfeatures(lcfile, outdir,
... |
This drives the get_starfeatures function for a collection of LCs. | def serial_starfeatures(lclist,
outdir,
lc_catalog_pickle,
neighbor_radius_arcsec,
maxobjects=None,
deredden=True,
custom_bandpasses=None,
lcformat='hat... |
This runs get_starfeatures in parallel for all light curves in lclist. | def parallel_starfeatures(lclist,
outdir,
lc_catalog_pickle,
neighbor_radius_arcsec,
maxobjects=None,
deredden=True,
custom_bandpasses=None,
... |
This runs parallel star feature extraction for a directory of LCs. | def parallel_starfeatures_lcdir(lcdir,
outdir,
lc_catalog_pickle,
neighbor_radius_arcsec,
fileglob=None,
maxobjects=None,
deredd... |
This writes a multiple lspinfo checkplot to a dict. | def checkplot_dict(
lspinfolist,
times,
mags,
errs,
fast_mode=False,
magsarefluxes=False,
nperiodstouse=3,
objectinfo=None,
deredden_object=True,
custom_bandpasses=None,
gaia_submit_timeout=10.0,
gaia_submit_tries=3,
... |
This writes a multiple lspinfo checkplot to a ( gzipped ) pickle file. | def checkplot_pickle(
lspinfolist,
times,
mags,
errs,
fast_mode=False,
magsarefluxes=False,
nperiodstouse=3,
objectinfo=None,
deredden_object=True,
custom_bandpasses=None,
gaia_submit_timeout=10.0,
gaia_submit_tries=3,
... |
This updates the current checkplotdict with updated values provided. | def checkplot_pickle_update(
currentcp,
updatedcp,
outfile=None,
outgzip=False,
pickleprotocol=None,
verbose=True
):
'''This updates the current checkplotdict with updated values provided.
Parameters
----------
currentcp : dict or str
This is ei... |
This calculates a frequency grid for the period finding functions in this module. | def get_frequency_grid(times,
samplesperpeak=5,
nyquistfactor=5,
minfreq=None,
maxfreq=None,
returnf0dfnf=False):
'''This calculates a frequency grid for the period finding functions in this
module... |
This bins the phased mag series using the given binsize. | def pwd_phasebin(phases, mags, binsize=0.002, minbin=9):
'''
This bins the phased mag series using the given binsize.
'''
bins = np.arange(0.0, 1.0, binsize)
binnedphaseinds = npdigitize(phases, bins)
binnedphases, binnedmags = [], []
for x in npunique(binnedphaseinds):
thisbin_... |
This is the parallel worker for the function below. | def pdw_worker(task):
'''
This is the parallel worker for the function below.
task[0] = frequency for this worker
task[1] = times array
task[2] = mags array
task[3] = fold_time
task[4] = j_range
task[5] = keep_threshold_1
task[6] = keep_threshold_2
task[7] = phasebinsize
we... |
This is the parallel version of the function above. | def pdw_period_find(times,
mags,
errs,
autofreq=True,
init_p=None,
end_p=None,
f_step=1.0e-4,
phasebinsize=None,
sigclip=10.0,
nworkers=None... |
This calculates the periodogram value for each omega ( = 2 * pi * f ). Mags must be normalized to zero with variance scaled to unity. | def townsend_lombscargle_value(times, mags, omega):
'''
This calculates the periodogram value for each omega (= 2*pi*f). Mags must
be normalized to zero with variance scaled to unity.
'''
cos_omegat = npcos(omega*times)
sin_omegat = npsin(omega*times)
xc = npsum(mags*cos_omegat)
xs = n... |
This calculates the Lomb - Scargle periodogram for the frequencies corresponding to the period interval ( startp endp ) using a frequency step size of stepsize cycles/ day. This uses the algorithm in Townsend 2010. | def parallel_townsend_lsp(times, mags, startp, endp,
stepsize=1.0e-4,
nworkers=4):
'''
This calculates the Lomb-Scargle periodogram for the frequencies
corresponding to the period interval (startp, endp) using a frequency step
size of stepsize cycles/d... |
This uses the LSP function from the scipy library which is fast as hell. We try to make it faster by running LSP for sections of the omegas array in parallel. | def scipylsp_parallel(times,
mags,
errs, # ignored but for consistent API
startp,
endp,
nbestpeaks=5,
periodepsilon=0.1, # 0.1
stepsize=1.0e-4,
... |
This gets all periodic features for the object. | def get_periodicfeatures(
pfpickle,
lcbasedir,
outdir,
fourierorder=5,
# these are depth, duration, ingress duration
transitparams=(-0.01,0.1,0.1),
# these are depth, duration, depth ratio, secphase
ebparams=(-0.2,0.3,0.7,0.5),
pdiff_threshold=1.0e... |
This is a parallel worker for the drivers below. | def _periodicfeatures_worker(task):
'''
This is a parallel worker for the drivers below.
'''
pfpickle, lcbasedir, outdir, starfeatures, kwargs = task
try:
return get_periodicfeatures(pfpickle,
lcbasedir,
outdir,
... |
This drives the periodicfeatures collection for a list of periodfinding pickles. | def serial_periodicfeatures(pfpkl_list,
lcbasedir,
outdir,
starfeaturesdir=None,
fourierorder=5,
# these are depth, duration, ingress duration
transitpa... |
This runs periodic feature generation in parallel for all periodfinding pickles in the input list. | def parallel_periodicfeatures(pfpkl_list,
lcbasedir,
outdir,
starfeaturesdir=None,
fourierorder=5,
# these are depth, duration, ingress duration
... |
This runs parallel periodicfeature extraction for a directory of periodfinding result pickles. | def parallel_periodicfeatures_lcdir(
pfpkl_dir,
lcbasedir,
outdir,
pfpkl_glob='periodfinding-*.pkl*',
starfeaturesdir=None,
fourierorder=5,
# these are depth, duration, ingress duration
transitparams=(-0.01,0.1,0.1),
# these are depth, duration, de... |
This parses the header for a catalog file and returns it as a file object. | def _parse_xmatch_catalog_header(xc, xk):
'''
This parses the header for a catalog file and returns it as a file object.
Parameters
----------
xc : str
The file name of an xmatch catalog prepared previously.
xk : list of str
This is a list of column names to extract from the x... |
This loads the external xmatch catalogs into a dict for use in an xmatch. | def load_xmatch_external_catalogs(xmatchto, xmatchkeys, outfile=None):
'''This loads the external xmatch catalogs into a dict for use in an xmatch.
Parameters
----------
xmatchto : list of str
This is a list of paths to all the catalog text files that will be
loaded.
The text ... |
This matches the current object in the checkplotdict to all of the external match catalogs specified. | def xmatch_external_catalogs(checkplotdict,
xmatchinfo,
xmatchradiusarcsec=2.0,
returndirect=False,
updatexmatch=True,
savepickle=None):
'''This matches the current object... |
Wraps the input angle to 360. 0 degrees. | def angle_wrap(angle, radians=False):
'''Wraps the input angle to 360.0 degrees.
Parameters
----------
angle : float
The angle to wrap around 360.0 deg.
radians : bool
If True, will assume that the input is in radians. The output will then
also be in radians.
Returns
... |
Converts from decimal degrees ( for declination coords ) to DD: MM: SS. | def decimal_to_dms(decimal_value):
'''Converts from decimal degrees (for declination coords) to DD:MM:SS.
Parameters
----------
decimal_value : float
A decimal value to convert to degrees, minutes, seconds sexagesimal
format.
Returns
-------
tuple
A four element t... |
Converts from decimal degrees ( for RA coords ) to HH: MM: SS. | def decimal_to_hms(decimal_value):
'''Converts from decimal degrees (for RA coords) to HH:MM:SS.
Parameters
----------
decimal_value : float
A decimal value to convert to hours, minutes, seconds. Negative values
will be wrapped around 360.0.
Returns
-------
tuple
... |
Converts a string of the form HH: MM: SS or HH MM SS to a tuple of the form ( HH MM SS ). | def hms_str_to_tuple(hms_string):
'''Converts a string of the form HH:MM:SS or HH MM SS to a tuple of the form
(HH, MM, SS).
Parameters
----------
hms_string : str
A RA coordinate string of the form 'HH:MM:SS.sss' or 'HH MM SS.sss'.
Returns
-------
tuple
A three eleme... |
Converts a string of the form [ + - ] DD: MM: SS or [ + - ] DD MM SS to a tuple of the form ( sign DD MM SS ). | def dms_str_to_tuple(dms_string):
'''Converts a string of the form [+-]DD:MM:SS or [+-]DD MM SS to a tuple of
the form (sign, DD, MM, SS).
Parameters
----------
dms_string : str
A declination coordinate string of the form '[+-]DD:MM:SS.sss' or
'[+-]DD MM SS.sss'. The sign in front ... |
Converts from HH MM SS to a decimal value. | def hms_to_decimal(hours, minutes, seconds, returndeg=True):
'''Converts from HH, MM, SS to a decimal value.
Parameters
----------
hours : int
The HH part of a RA coordinate.
minutes : int
The MM part of a RA coordinate.
seconds : float
The SS.sss part of a RA coordin... |
Converts from DD: MM: SS to a decimal value. | def dms_to_decimal(sign, degrees, minutes, seconds):
'''Converts from DD:MM:SS to a decimal value.
Parameters
----------
sign : {'+', '-', ''}
The sign part of a Dec coordinate.
degrees : int
The DD part of a Dec coordinate.
minutes : int
The MM part of a Dec coordina... |
Calculates the great circle angular distance between two coords. | def great_circle_dist(ra1, dec1, ra2, dec2):
'''Calculates the great circle angular distance between two coords.
This calculates the great circle angular distance in arcseconds between two
coordinates (ra1,dec1) and (ra2,dec2). This is basically a clone of GCIRC
from the IDL Astrolib.
Parameters
... |
Finds the closest object in ( ra2 dec2 ) to scalar coordinate pair ( ra1 dec1 ) and returns the distance in arcseconds. | def xmatch_basic(ra1, dec1, ra2, dec2, match_radius=5.0):
'''Finds the closest object in (`ra2`, `dec2`) to scalar coordinate pair
(`ra1`, `dec1`) and returns the distance in arcseconds.
This is a quick matcher that uses the `great_circle_dist` function to find
the closest object in (`ra2`, `dec2`) wit... |
Finds the closest objects in ( ra2 dec2 ) to scalar coordinate pair ( ra1 dec1 ) and returns the indices of the objects that match. | def xmatch_neighbors(ra1, dec1,
ra2, dec2,
match_radius=60.0,
includeself=False,
sortresults=True):
'''Finds the closest objects in (`ra2`, `dec2`) to scalar coordinate pair
(`ra1`, `dec1`) and returns the indices of the objects... |
This makes a scipy. spatial. CKDTree on ( ra decl ). | def make_kdtree(ra, decl):
'''This makes a `scipy.spatial.CKDTree` on (`ra`, `decl`).
Parameters
----------
ra,decl : array-like
The right ascension and declination coordinate pairs in decimal degrees.
Returns
-------
`scipy.spatial.CKDTree`
The cKDTRee object generated b... |
This does a cone - search around ( racenter declcenter ) in kdtree. | def conesearch_kdtree(kdtree,
racenter,
declcenter,
searchradiusdeg,
conesearchworkers=1):
'''This does a cone-search around (`racenter`, `declcenter`) in `kdtree`.
Parameters
----------
kdtree : scipy.spatial.CKDT... |
This cross - matches between kdtree and ( extra extdecl ) arrays. | def xmatch_kdtree(kdtree,
extra, extdecl,
xmatchdistdeg,
closestonly=True):
'''This cross-matches between `kdtree` and (`extra`, `extdecl`) arrays.
Returns the indices of the kdtree and the indices of extra, extdecl that
xmatch successfully.
Parame... |
This calculates the total proper motion of an object. | def total_proper_motion(pmra, pmdecl, decl):
'''This calculates the total proper motion of an object.
Parameters
----------
pmra : float or array-like
The proper motion(s) in right ascension, measured in mas/yr.
pmdecl : float or array-like
The proper motion(s) in declination, me... |
This converts from equatorial coords to galactic coords. | def equatorial_to_galactic(ra, decl, equinox='J2000'):
'''This converts from equatorial coords to galactic coords.
Parameters
----------
ra : float or array-like
Right ascension values(s) in decimal degrees.
decl : float or array-like
Declination value(s) in decimal degrees.
... |
This converts from galactic coords to equatorial coordinates. | def galactic_to_equatorial(gl, gb):
'''This converts from galactic coords to equatorial coordinates.
Parameters
----------
gl : float or array-like
Galactic longitude values(s) in decimal degrees.
gb : float or array-like
Galactic latitude value(s) in decimal degrees.
Returns... |
This returns the image - plane projected xi - eta coords for inra indecl. | def xieta_from_radecl(inra, indecl,
incenterra, incenterdecl,
deg=True):
'''This returns the image-plane projected xi-eta coords for inra, indecl.
Parameters
----------
inra,indecl : array-like
The equatorial coordinates to get the xi, eta coordinate... |
This generates fake planet transit light curves. | def generate_transit_lightcurve(
times,
mags=None,
errs=None,
paramdists={'transitperiod':sps.uniform(loc=0.1,scale=49.9),
'transitdepth':sps.uniform(loc=1.0e-4,scale=2.0e-2),
'transitduration':sps.uniform(loc=0.01,scale=0.29)},
magsareflux... |
This generates fake EB light curves. | def generate_eb_lightcurve(
times,
mags=None,
errs=None,
paramdists={'period':sps.uniform(loc=0.2,scale=99.8),
'pdepth':sps.uniform(loc=1.0e-4,scale=0.7),
'pduration':sps.uniform(loc=0.01,scale=0.44),
'depthratio':sps.uniform(lo... |
This generates fake flare light curves. | def generate_flare_lightcurve(
times,
mags=None,
errs=None,
paramdists={
# flare peak amplitude from 0.01 mag to 1.0 mag above median. this
# is tuned for redder bands, flares are much stronger in bluer
# bands, so tune appropriately for your situatio... |
This generates fake sinusoidal light curves. | def generate_sinusoidal_lightcurve(
times,
mags=None,
errs=None,
paramdists={
'period':sps.uniform(loc=0.04,scale=500.0),
'fourierorder':[2,10],
'amplitude':sps.uniform(loc=0.1,scale=0.9),
'phioffset':0.0,
},
magsarefluxes=F... |
This generates fake RRab light curves. | def generate_rrab_lightcurve(
times,
mags=None,
errs=None,
paramdists={
'period':sps.uniform(loc=0.45,scale=0.35),
'fourierorder':[8,11],
'amplitude':sps.uniform(loc=0.4,scale=0.5),
'phioffset':np.pi,
},
magsarefluxes=False
... |
This preprocesses an input real LC and sets it up to be a fake LC. | def make_fakelc(lcfile,
outdir,
magrms=None,
randomizemags=True,
randomizecoords=False,
lcformat='hat-sql',
lcformatdir=None,
timecols=None,
magcols=None,
errcols=None):
''... |
This wraps process_fakelc for make_fakelc_collection below. | def collection_worker(task):
'''
This wraps `process_fakelc` for `make_fakelc_collection` below.
Parameters
----------
task : tuple
This is of the form::
task[0] = lcfile
task[1] = outdir
task[2] = magrms
task[3] = dict with keys: {'lcformat... |
This prepares light curves for the recovery sim. | def make_fakelc_collection(lclist,
simbasedir,
magrmsfrom,
magrms_interpolate='quadratic',
magrms_fillvalue='extrapolate',
maxlcs=25000,
maxvars=2000,
... |
This adds variability of the specified type to the fake LC. | def add_fakelc_variability(fakelcfile,
vartype,
override_paramdists=None,
magsarefluxes=False,
overwrite=False):
'''This adds variability of the specified type to the fake LC.
The procedure is (for each ... |
This adds variability and noise to all fake LCs in simbasedir. | def add_variability_to_fakelc_collection(simbasedir,
override_paramdists=None,
overwrite_existingvar=False):
'''This adds variability and noise to all fake LCs in `simbasedir`.
If an object is marked as variable in the `fakelcs-i... |
This adds a flare model function to the input magnitude/ flux time - series. | def add_flare_model(flareparams,
times,
mags,
errs):
'''This adds a flare model function to the input magnitude/flux time-series.
Parameters
----------
flareparams : list of float
This defines the flare model::
[amplitude... |
This finds flares in time series using the method in Walkowicz + 2011. | def simple_flare_find(times, mags, errs,
smoothbinsize=97,
flare_minsigma=4.0,
flare_maxcadencediff=1,
flare_mincadencepoints=3,
magsarefluxes=False,
savgol_polyorder=2,
... |
This returns a smoothed version of the ACF. | def _smooth_acf(acf, windowfwhm=7, windowsize=21):
'''This returns a smoothed version of the ACF.
Convolves the ACF with a Gaussian of given `windowsize` and `windowfwhm`.
Parameters
----------
acf : np.array
The auto-correlation function array to smooth.
windowfwhm : int
The... |
This returns a smoothed version of the ACF. | def _smooth_acf_savgol(acf, windowsize=21, polyorder=2):
'''
This returns a smoothed version of the ACF.
This version uses the Savitsky-Golay smoothing filter.
Parameters
----------
acf : np.array
The auto-correlation function array to smooth.
windowsize : int
The number ... |
This calculates the relative peak heights for first npeaks in ACF. | def _get_acf_peakheights(lags, acf, npeaks=20, searchinterval=1):
'''This calculates the relative peak heights for first npeaks in ACF.
Usually, the first peak or the second peak (if its peak height > first peak)
corresponds to the correct lag. When we know the correct lag, the period is
then::
... |
This plots the unsmoothed/ smoothed ACF vs lag. | def plot_acf_results(acfp, outfile, maxlags=5000, yrange=(-0.4,0.4)):
'''
This plots the unsmoothed/smoothed ACF vs lag.
Parameters
----------
acfp : dict
This is the dict returned from `macf_period_find` below.
outfile : str
The output file the plot will be written to.
m... |
This finds periods using the McQuillan + ( 2013a 2014 ) ACF method. | def macf_period_find(
times,
mags,
errs,
fillgaps=0.0,
filterwindow=11,
forcetimebin=None,
maxlags=None,
maxacfpeaks=10,
smoothacf=21, # set for Kepler-type LCs, see details below
smoothfunc=_smooth_acf_savgol,
smoothfunckwargs=Non... |
Calculates the autocorr of mag series for specific lag. | def _autocorr_func1(mags, lag, maglen, magmed, magstd):
'''Calculates the autocorr of mag series for specific lag.
This version of the function is taken from: Kim et al. (`2011
<https://dx.doi.org/10.1088/0004-637X/735/2/68>`_)
Parameters
----------
mags : np.array
This is the magnitu... |
This is an alternative function to calculate the autocorrelation. | def _autocorr_func2(mags, lag, maglen, magmed, magstd):
'''
This is an alternative function to calculate the autocorrelation.
This version is from (first definition):
https://en.wikipedia.org/wiki/Correlogram#Estimation_of_autocorrelations
Parameters
----------
mags : np.array
Th... |
This is yet another alternative to calculate the autocorrelation. | def _autocorr_func3(mags, lag, maglen, magmed, magstd):
'''
This is yet another alternative to calculate the autocorrelation.
Taken from: `Bayesian Methods for Hackers by Cameron Pilon <http://nbviewer.jupyter.org/github/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/maste... |
This calculates the ACF of a light curve. | def autocorr_magseries(times, mags, errs,
maxlags=1000,
func=_autocorr_func3,
fillgaps=0.0,
filterwindow=11,
forcetimebin=None,
sigclip=3.0,
magsarefluxes=Fals... |
This calculates the harmonic AoV theta statistic for a frequency. | def aovhm_theta(times, mags, errs, frequency,
nharmonics, magvariance):
'''This calculates the harmonic AoV theta statistic for a frequency.
This is a mostly faithful translation of the inner loop in `aovper.f90`. See
the following for details:
- http://users.camk.edu.pl/alex/
- Sc... |
This is a parallel worker for the function below. | def _aovhm_theta_worker(task):
'''
This is a parallel worker for the function below.
Parameters
----------
tasks : tuple
This is of the form below::
task[0] = times
task[1] = mags
task[2] = errs
task[3] = frequency
task[4] = nhar... |
This opens a new database connection. | def open(self, database, user, password, host):
'''This opens a new database connection.
Parameters
----------
database : str
Name of the database to connect to.
user : str
User name of the database server user.
password : str
Passw... |
This opens the database connection using the default database parameters given in the ~/. astrobase/ astrobase. conf file. | def open_default(self):
'''
This opens the database connection using the default database parameters
given in the ~/.astrobase/astrobase.conf file.
'''
if HAVECONF:
self.open(DBDATA, DBUSER, DBPASS, DBHOST)
else:
LOGERROR("no default DB connectio... |
This sets the database connection to autocommit. Must be called before any cursors have been instantiated. | def autocommit(self):
'''
This sets the database connection to autocommit. Must be called before
any cursors have been instantiated.
'''
if len(self.cursors.keys()) == 0:
self.connection.autocommit = True
else:
raise AttributeError('database curs... |
This gets or creates a DB cursor for the current DB connection. | def cursor(self, handle, dictcursor=False):
'''This gets or creates a DB cursor for the current DB connection.
Parameters
----------
handle : str
The name of the cursor to look up in the existing list or if it
doesn't exist, the name to be used for a new cursor ... |
This creates a DB cursor for the current DB connection using a randomly generated handle. Returns a tuple with cursor and handle. | def newcursor(self, dictcursor=False):
'''
This creates a DB cursor for the current DB connection using a
randomly generated handle. Returns a tuple with cursor and handle.
Parameters
----------
dictcursor : bool
If True, returns a cursor where each returned... |
This just calls the connection s commit method. | def commit(self):
'''
This just calls the connection's commit method.
'''
if not self.connection.closed:
self.connection.commit()
else:
raise AttributeError('postgres connection to %s is closed' %
self.database) |
This just calls the connection s commit method. | def rollback(self):
'''
This just calls the connection's commit method.
'''
if not self.connection.closed:
self.connection.rollback()
else:
raise AttributeError('postgres connection to %s is closed' %
self.database) |
Closes the cursor specified and removes it from the self. cursors dictionary. | def close_cursor(self, handle):
'''
Closes the cursor specified and removes it from the `self.cursors`
dictionary.
'''
if handle in self.cursors:
self.cursors[handle].close()
else:
raise KeyError('cursor with handle %s was not found' % handle) |
This returns a trapezoid transit - shaped function. | def trapezoid_transit_func(transitparams, times, mags, errs,
get_ntransitpoints=False):
'''This returns a trapezoid transit-shaped function.
Suitable for first order modeling of transit signals.
Parameters
----------
transitparams : list of float
This contains t... |
This returns the residual between the modelmags and the actual mags. | def trapezoid_transit_residual(transitparams, times, mags, errs):
'''
This returns the residual between the modelmags and the actual mags.
Parameters
----------
transitparams : list of float
This contains the transiting planet trapezoid model::
transitparams = [transitperiod (... |
This queries the SIMBAD TAP service using the ADQL query string provided. | def tap_query(querystr,
simbad_mirror='simbad',
returnformat='csv',
forcefetch=False,
cachedir='~/.astrobase/simbad-cache',
verbose=True,
timeout=10.0,
refresh=2.0,
maxtimeout=90.0,
maxtries=3,
... |
This queries the SIMBAD TAP service for a list of object names near the coords. This is effectively a reverse name resolver ( i. e. this does the opposite of SESAME ). | def objectnames_conesearch(racenter,
declcenter,
searchradiusarcsec,
simbad_mirror='simbad',
returnformat='csv',
forcefetch=False,
cachedir='~/.astrobase/simb... |
This xmatches external catalogs to a collection of checkplots. | def xmatch_cplist_external_catalogs(cplist,
xmatchpkl,
xmatchradiusarcsec=2.0,
updateexisting=True,
resultstodir=None):
'''This xmatches external catalogs to a collection o... |
This xmatches external catalogs to all checkplots in a directory. | def xmatch_cpdir_external_catalogs(cpdir,
xmatchpkl,
cpfileglob='checkplot-*.pkl*',
xmatchradiusarcsec=2.0,
updateexisting=True,
resultstodir=Non... |
This makes color - mag diagrams for all checkplot pickles in the provided list. | def colormagdiagram_cplist(cplist,
outpkl,
color_mag1=['gaiamag','sdssg'],
color_mag2=['kmag','kmag'],
yaxis_mag=['gaia_absmag','rpmj']):
'''This makes color-mag diagrams for all checkplot pickles in the prov... |
This makes CMDs for all checkplot pickles in the provided directory. | def colormagdiagram_cpdir(
cpdir,
outpkl,
cpfileglob='checkplot*.pkl*',
color_mag1=['gaiamag','sdssg'],
color_mag2=['kmag','kmag'],
yaxis_mag=['gaia_absmag','rpmj']
):
'''This makes CMDs for all checkplot pickles in the provided directory.
Can make an arbitrary n... |
This adds CMD figures to a checkplot dict or pickle. | def add_cmd_to_checkplot(
cpx,
cmdpkl,
require_cmd_magcolor=True,
save_cmd_pngs=False
):
'''This adds CMD figures to a checkplot dict or pickle.
Looks up the CMDs in `cmdpkl`, adds the object from `cpx` as a gold(-ish)
star in the plot, and then saves the figure to a base64 ... |
This adds CMDs for each object in cplist. | def add_cmds_cplist(cplist, cmdpkl,
require_cmd_magcolor=True,
save_cmd_pngs=False):
'''This adds CMDs for each object in cplist.
Parameters
----------
cplist : list of str
This is the input list of checkplot pickles to add the CMDs to.
cmdpkl : str... |
This adds CMDs for each object in cpdir. | def add_cmds_cpdir(cpdir,
cmdpkl,
cpfileglob='checkplot*.pkl*',
require_cmd_magcolor=True,
save_cmd_pngs=False):
'''This adds CMDs for each object in cpdir.
Parameters
----------
cpdir : list of str
This is the directo... |
This is a parallel worker for parallel_update_cp_objectinfo. | def cp_objectinfo_worker(task):
'''This is a parallel worker for `parallel_update_cp_objectinfo`.
Parameters
----------
task : tuple
- task[0] = checkplot pickle file
- task[1] = kwargs
Returns
-------
str
The name of the checkplot file that was updated. None if t... |
This updates objectinfo for a list of checkplots. | def parallel_update_objectinfo_cplist(
cplist,
liststartindex=None,
maxobjects=None,
nworkers=NCPUS,
fast_mode=False,
findercmap='gray_r',
finderconvolve=None,
deredden_object=True,
custom_bandpasses=None,
gaia_submit_timeout=10.0,
... |
This updates the objectinfo for a directory of checkplot pickles. | def parallel_update_objectinfo_cpdir(cpdir,
cpglob='checkplot-*.pkl*',
liststartindex=None,
maxobjects=None,
nworkers=NCPUS,
fast_mode=... |
This gets the required keys from the requested file. | def checkplot_infokey_worker(task):
'''This gets the required keys from the requested file.
Parameters
----------
task : tuple
Task is a two element tuple::
- task[0] is the dict to work on
- task[1] is a list of lists of str indicating all the key address to
extrac... |
This is the main function of this script. | def main():
'''This is the main function of this script.
The current script args are shown below ::
Usage: checkplotlist [-h] [--search SEARCH] [--sortby SORTBY]
[--filterby FILTERBY] [--splitout SPLITOUT]
[--outprefix OUTPREFIX] [--maxkeyworke... |
This is a simple gaussian. | def _gaussian(x, amp, loc, std):
'''This is a simple gaussian.
Parameters
----------
x : np.array
The items at which the Gaussian is evaluated.
amp : float
The amplitude of the Gaussian.
loc : float
The central value of the Gaussian.
std : float
The stand... |
This is a double inverted gaussian. | def _double_inverted_gaussian(x,
amp1, loc1, std1,
amp2, loc2, std2):
'''This is a double inverted gaussian.
Parameters
----------
x : np.array
The items at which the Gaussian is evaluated.
amp1,amp2 : float
The amplitude... |
This returns a double eclipse shaped function. | def invgauss_eclipses_func(ebparams, times, mags, errs):
'''This returns a double eclipse shaped function.
Suitable for first order modeling of eclipsing binaries.
Parameters
----------
ebparams : list of float
This contains the parameters for the eclipsing binary::
ebparams ... |
This returns the residual between the modelmags and the actual mags. | def invgauss_eclipses_residual(ebparams, times, mags, errs):
'''This returns the residual between the modelmags and the actual mags.
Parameters
----------
ebparams : list of float
This contains the parameters for the eclipsing binary::
ebparams = [period (time),
... |
This converts between JHK and BVRI/ SDSS mags. | def convert_constants(jmag, hmag, kmag,
cjhk,
cjh, cjk, chk,
cj, ch, ck):
'''This converts between JHK and BVRI/SDSS mags.
Not meant to be used directly. See the functions below for more sensible
interface. This function does the grunt work ... |
Converts given J H Ks mags to a B magnitude value. | def jhk_to_bmag(jmag, hmag, kmag):
'''Converts given J, H, Ks mags to a B magnitude value.
Parameters
----------
jmag,hmag,kmag : float
2MASS J, H, Ks mags of the object.
Returns
-------
float
The converted B band magnitude.
'''
return convert_constants(jmag,hma... |
Converts given J H Ks mags to a V magnitude value. | def jhk_to_vmag(jmag,hmag,kmag):
'''Converts given J, H, Ks mags to a V magnitude value.
Parameters
----------
jmag,hmag,kmag : float
2MASS J, H, Ks mags of the object.
Returns
-------
float
The converted V band magnitude.
'''
return convert_constants(jmag,hmag,... |
Converts given J H Ks mags to an R magnitude value. | def jhk_to_rmag(jmag,hmag,kmag):
'''Converts given J, H, Ks mags to an R magnitude value.
Parameters
----------
jmag,hmag,kmag : float
2MASS J, H, Ks mags of the object.
Returns
-------
float
The converted R band magnitude.
'''
return convert_constants(jmag,hmag... |
Converts given J H Ks mags to an I magnitude value. | def jhk_to_imag(jmag,hmag,kmag):
'''Converts given J, H, Ks mags to an I magnitude value.
Parameters
----------
jmag,hmag,kmag : float
2MASS J, H, Ks mags of the object.
Returns
-------
float
The converted I band magnitude.
'''
return convert_constants(jmag,hmag... |
Converts given J H Ks mags to an SDSS u magnitude value. | def jhk_to_sdssu(jmag,hmag,kmag):
'''Converts given J, H, Ks mags to an SDSS u magnitude value.
Parameters
----------
jmag,hmag,kmag : float
2MASS J, H, Ks mags of the object.
Returns
-------
float
The converted SDSS u band magnitude.
'''
return convert_constant... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.