_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q258800 | _epd_function | validation | def _epd_function(coeffs, fluxes, xcc, ycc, bgv, bge):
'''This is the EPD function to fit.
Parameters
----------
coeffs : array-like of floats
Contains the EPD coefficients that will be used to generate the EPD fit
function.
fluxes : array-like
The flux measurement array b... | python | {
"resource": ""
} |
q258801 | get_centroid_offsets | validation | def get_centroid_offsets(lcd, t_ing_egr, oot_buffer_time=0.1, sample_factor=3):
'''After running `detrend_centroid`, this gets positions of centroids during
transits, and outside of transits.
These positions can then be used in a false positive analysis.
This routine requires knowing the ingress and e... | python | {
"resource": ""
} |
q258802 | _get_legendre_deg_ctd | validation | def _get_legendre_deg_ctd(npts):
'''This is a helper function for centroid detrending.
'''
from scipy.interpolate import interp1d
degs = nparray([4,5,6,10,15])
pts = nparray([1e2,3e2,5e2,1e3,3e3])
fn = interp1d(pts, degs, kind='linear',
bounds_error=False,
... | python | {
"resource": ""
} |
q258803 | _legendre_dtr | validation | def _legendre_dtr(x, y, y_err, legendredeg=10):
'''This calculates the residual and chi-sq values for a Legendre
function fit.
Parameters
----------
x : np.array
Array of the independent variable.
y : np.array
Array of the dependent variable.
y_err : np.array
Arra... | python | {
"resource": ""
} |
q258804 | timebinlc | validation | def timebinlc(lcfile,
binsizesec,
outdir=None,
lcformat='hat-sql',
lcformatdir=None,
timecols=None,
magcols=None,
errcols=None,
minbinelems=7):
'''This bins the given light curve file in time using the s... | python | {
"resource": ""
} |
q258805 | parallel_timebin | validation | def parallel_timebin(lclist,
binsizesec,
maxobjects=None,
outdir=None,
lcformat='hat-sql',
lcformatdir=None,
timecols=None,
magcols=None,
errcols=None,
... | python | {
"resource": ""
} |
q258806 | parallel_timebin_lcdir | validation | def parallel_timebin_lcdir(lcdir,
binsizesec,
maxobjects=None,
outdir=None,
lcformat='hat-sql',
lcformatdir=None,
timecols=None,
ma... | python | {
"resource": ""
} |
q258807 | _varfeatures_worker | validation | def _varfeatures_worker(task):
'''
This wraps varfeatures.
'''
try:
(lcfile, outdir, timecols, magcols, errcols,
mindet, lcformat, lcformatdir) = task
return get_varfeatures(lcfile, outdir,
timecols=timecols,
magcol... | python | {
"resource": ""
} |
q258808 | serial_varfeatures | validation | def serial_varfeatures(lclist,
outdir,
maxobjects=None,
timecols=None,
magcols=None,
errcols=None,
mindet=1000,
lcformat='hat-sql',
lcfo... | python | {
"resource": ""
} |
q258809 | parallel_varfeatures | validation | def parallel_varfeatures(lclist,
outdir,
maxobjects=None,
timecols=None,
magcols=None,
errcols=None,
mindet=1000,
lcformat='hat-sql',
... | python | {
"resource": ""
} |
q258810 | parallel_varfeatures_lcdir | validation | def parallel_varfeatures_lcdir(lcdir,
outdir,
fileglob=None,
maxobjects=None,
timecols=None,
magcols=None,
errcols=None,
... | python | {
"resource": ""
} |
q258811 | cp2png | validation | def cp2png(checkplotin, extrarows=None):
'''This is just a shortened form of the function above for convenience.
This only handles pickle files as input.
Parameters
----------
checkplotin : str
File name of a checkplot pickle file to convert to a PNG.
extrarows : list of tuples
... | python | {
"resource": ""
} |
q258812 | flare_model | validation | def flare_model(flareparams, times, mags, errs):
'''This is a flare model function, similar to Kowalski+ 2011.
From the paper by Pitkin+ 2014:
http://adsabs.harvard.edu/abs/2014MNRAS.445.2268P
Parameters
----------
flareparams : list of float
This defines the flare model::
... | python | {
"resource": ""
} |
q258813 | flare_model_residual | validation | def flare_model_residual(flareparams, times, mags, errs):
'''
This returns the residual between model mags and the actual mags.
Parameters
----------
flareparams : list of float
This defines the flare model::
[amplitude,
flare_peak_time,
rise_gaussian... | python | {
"resource": ""
} |
q258814 | shutdown_check_handler | validation | def shutdown_check_handler():
"""This checks the AWS instance data URL to see if there's a pending
shutdown for the instance.
This is useful for AWS spot instances. If there is a pending shutdown posted
to the instance data URL, we'll use the result of this function break out of
the processing loop... | python | {
"resource": ""
} |
q258815 | runcp_producer_loop_savedstate | validation | def runcp_producer_loop_savedstate(
use_saved_state=None,
lightcurve_list=None,
input_queue=None,
input_bucket=None,
result_queue=None,
result_bucket=None,
pfresult_list=None,
runcp_kwargs=None,
process_list_slice=None,
download_when_done=T... | python | {
"resource": ""
} |
q258816 | spline_fit_magseries | validation | def spline_fit_magseries(times, mags, errs, period,
knotfraction=0.01,
maxknots=30,
sigclip=30.0,
plotfit=False,
ignoreinitfail=False,
magsarefluxes=False,
... | python | {
"resource": ""
} |
q258817 | runcp_worker | validation | def runcp_worker(task):
'''
This is the worker for running checkplots.
Parameters
----------
task : tuple
This is of the form: (pfpickle, outdir, lcbasedir, kwargs).
Returns
-------
list of str
The list of checkplot pickles returned by the `runcp` function.
'''
... | python | {
"resource": ""
} |
q258818 | parallel_cp | validation | def parallel_cp(
pfpicklelist,
outdir,
lcbasedir,
fast_mode=False,
lcfnamelist=None,
cprenorm=False,
lclistpkl=None,
gaia_max_timeout=60.0,
gaia_mirror=None,
nbrradiusarcsec=60.0,
maxnumneighbors=5,
makeneighborlcs=True,
... | python | {
"resource": ""
} |
q258819 | parallel_cp_pfdir | validation | def parallel_cp_pfdir(pfpickledir,
outdir,
lcbasedir,
pfpickleglob='periodfinding-*.pkl*',
lclistpkl=None,
cprenorm=False,
nbrradiusarcsec=60.0,
maxnumneighbors=5,
... | python | {
"resource": ""
} |
q258820 | _runpf_worker | validation | def _runpf_worker(task):
'''
This runs the runpf function.
'''
(lcfile, outdir, timecols, magcols, errcols, lcformat, lcformatdir,
pfmethods, pfkwargs, getblssnr, sigclip, nworkers, minobservations,
excludeprocessed) = task
if os.path.exists(lcfile):
pfresult = runpf(lcfile,
... | python | {
"resource": ""
} |
q258821 | parallel_pf | validation | def parallel_pf(lclist,
outdir,
timecols=None,
magcols=None,
errcols=None,
lcformat='hat-sql',
lcformatdir=None,
pfmethods=('gls','pdm','mav','win'),
pfkwargs=({},{},{},{}),
si... | python | {
"resource": ""
} |
q258822 | parallel_pf_lcdir | validation | def parallel_pf_lcdir(lcdir,
outdir,
fileglob=None,
recursive=True,
timecols=None,
magcols=None,
errcols=None,
lcformat='hat-sql',
lcformatdir=N... | python | {
"resource": ""
} |
q258823 | collect_nonperiodic_features | validation | def collect_nonperiodic_features(
featuresdir,
magcol,
outfile,
pklglob='varfeatures-*.pkl',
featurestouse=NONPERIODIC_FEATURES_TO_COLLECT,
maxobjects=None,
labeldict=None,
labeltype='binary',
):
'''This collects variability features into arrays for us... | python | {
"resource": ""
} |
q258824 | train_rf_classifier | validation | def train_rf_classifier(
collected_features,
test_fraction=0.25,
n_crossval_iterations=20,
n_kfolds=5,
crossval_scoring_metric='f1',
classifier_to_pickle=None,
nworkers=-1,
):
'''This gets the best RF classifier after running cross-validation.
- splits t... | python | {
"resource": ""
} |
q258825 | apply_rf_classifier | validation | def apply_rf_classifier(classifier,
varfeaturesdir,
outpickle,
maxobjects=None):
'''This applys an RF classifier trained using `train_rf_classifier`
to varfeatures pickles in `varfeaturesdir`.
Parameters
----------
classifier ... | python | {
"resource": ""
} |
q258826 | plot_training_results | validation | def plot_training_results(classifier,
classlabels,
outfile):
'''This plots the training results from the classifier run on the training
set.
- plots the confusion matrix
- plots the feature importances
- FIXME: plot the learning curves too, see:... | python | {
"resource": ""
} |
q258827 | _fourier_func | validation | def _fourier_func(fourierparams, phase, mags):
'''This returns a summed Fourier cosine series.
Parameters
----------
fourierparams : list
This MUST be a list of the following form like so::
[period,
epoch,
[amplitude_1, amplitude_2, amplitude_3, ..., ampl... | python | {
"resource": ""
} |
q258828 | _fourier_chisq | validation | def _fourier_chisq(fourierparams,
phase,
mags,
errs):
'''This is the chisq objective function to be minimized by `scipy.minimize`.
The parameters are the same as `_fourier_func` above. `errs` is used to
calculate the chisq value.
'''
f = _f... | python | {
"resource": ""
} |
q258829 | _fourier_residual | validation | def _fourier_residual(fourierparams,
phase,
mags):
'''
This is the residual objective function to be minimized by `scipy.leastsq`.
The parameters are the same as `_fourier_func` above.
'''
f = _fourier_func(fourierparams, phase, mags)
residual = mag... | python | {
"resource": ""
} |
q258830 | skyview_stamp | validation | def skyview_stamp(ra, decl,
survey='DSS2 Red',
scaling='Linear',
flip=True,
convolvewith=None,
forcefetch=False,
cachedir='~/.astrobase/stamp-cache',
timeout=10.0,
retry_failed... | python | {
"resource": ""
} |
q258831 | plot_periodbase_lsp | validation | def plot_periodbase_lsp(lspinfo, outfile=None, plotdpi=100):
'''Makes a plot of periodograms obtained from `periodbase` functions.
This takes the output dict produced by any `astrobase.periodbase`
period-finder function or a pickle filename containing such a dict and makes
a periodogram plot.
Par... | python | {
"resource": ""
} |
q258832 | lcdict_to_pickle | validation | def lcdict_to_pickle(lcdict, outfile=None):
'''This just writes the lcdict to a pickle.
If outfile is None, then will try to get the name from the
lcdict['objectid'] and write to <objectid>-hptxtlc.pkl. If that fails, will
write to a file named hptxtlc.pkl'.
'''
if not outfile and lcdict['obj... | python | {
"resource": ""
} |
q258833 | read_hatpi_pklc | validation | def read_hatpi_pklc(lcfile):
'''
This just reads a pickle LC. Returns an lcdict.
'''
try:
if lcfile.endswith('.gz'):
infd = gzip.open(lcfile,'rb')
else:
infd = open(lcfile,'rb')
lcdict = pickle.load(infd)
infd.close()
return lcdict
... | python | {
"resource": ""
} |
q258834 | concatenate_textlcs | validation | def concatenate_textlcs(lclist,
sortby='rjd',
normalize=True):
'''This concatenates a list of light curves.
Does not care about overlaps or duplicates. The light curves must all be
from the same aperture.
The intended use is to concatenate light curves a... | python | {
"resource": ""
} |
q258835 | concatenate_textlcs_for_objectid | validation | def concatenate_textlcs_for_objectid(lcbasedir,
objectid,
aperture='TF1',
postfix='.gz',
sortby='rjd',
normalize=True,
... | python | {
"resource": ""
} |
q258836 | concat_write_pklc | validation | def concat_write_pklc(lcbasedir,
objectid,
aperture='TF1',
postfix='.gz',
sortby='rjd',
normalize=True,
outdir=None,
recursive=True):
'''This concatenates all tex... | python | {
"resource": ""
} |
q258837 | parallel_concat_worker | validation | def parallel_concat_worker(task):
'''
This is a worker for the function below.
task[0] = lcbasedir
task[1] = objectid
task[2] = {'aperture','postfix','sortby','normalize','outdir','recursive'}
'''
lcbasedir, objectid, kwargs = task
try:
return concat_write_pklc(lcbasedir, obj... | python | {
"resource": ""
} |
q258838 | parallel_concat_lcdir | validation | def parallel_concat_lcdir(lcbasedir,
objectidlist,
aperture='TF1',
postfix='.gz',
sortby='rjd',
normalize=True,
outdir=None,
recursive=Tru... | python | {
"resource": ""
} |
q258839 | merge_hatpi_textlc_apertures | validation | def merge_hatpi_textlc_apertures(lclist):
'''This merges all TFA text LCs with separate apertures for a single object.
The framekey column will be used as the join column across all light curves
in lclist. Missing values will be filled in with nans. This function assumes
all light curves are in the for... | python | {
"resource": ""
} |
q258840 | generate_hatpi_binnedlc_pkl | validation | def generate_hatpi_binnedlc_pkl(binnedpklf, textlcf, timebinsec,
outfile=None):
'''
This reads the binned LC and writes it out to a pickle.
'''
binlcdict = read_hatpi_binnedlc(binnedpklf, textlcf, timebinsec)
if binlcdict:
if outfile is None:
ou... | python | {
"resource": ""
} |
q258841 | parallel_gen_binnedlc_pkls | validation | def parallel_gen_binnedlc_pkls(binnedpkldir,
textlcdir,
timebinsec,
binnedpklglob='*binned*sec*.pkl',
textlcglob='*.tfalc.TF1*'):
'''
This generates the binnedlc pkls for a directory of su... | python | {
"resource": ""
} |
q258842 | pklc_fovcatalog_objectinfo | validation | def pklc_fovcatalog_objectinfo(
pklcdir,
fovcatalog,
fovcatalog_columns=[0,1,2,
6,7,
8,9,
10,11,
13,14,15,16,
17,18,19,
20,21],
... | python | {
"resource": ""
} |
q258843 | _base64_to_file | validation | def _base64_to_file(b64str, outfpath, writetostrio=False):
'''This converts the base64 encoded string to a file.
Parameters
----------
b64str : str
A base64 encoded strin that is the output of `base64.b64encode`.
outfpath : str
The path to where the file will be written. This shou... | python | {
"resource": ""
} |
q258844 | _read_checkplot_picklefile | validation | def _read_checkplot_picklefile(checkplotpickle):
'''This reads a checkplot gzipped pickle file back into a dict.
NOTE: the try-except is for Python 2 pickles that have numpy arrays in
them. Apparently, these aren't compatible with Python 3. See here:
http://stackoverflow.com/q/11305790
The workar... | python | {
"resource": ""
} |
q258845 | make_fit_plot | validation | def make_fit_plot(phase, pmags, perrs, fitmags,
period, mintime, magseriesepoch,
plotfit,
magsarefluxes=False,
wrap=False,
model_over_lc=False):
'''This makes a plot of the LC model fit.
Parameters
----------
pha... | python | {
"resource": ""
} |
q258846 | objectlist_conesearch | validation | def objectlist_conesearch(racenter,
declcenter,
searchradiusarcsec,
gaia_mirror=None,
columns=('source_id',
'ra','dec',
'phot_g_mean_mag',
... | python | {
"resource": ""
} |
q258847 | objectlist_radeclbox | validation | def objectlist_radeclbox(radeclbox,
gaia_mirror=None,
columns=('source_id',
'ra','dec',
'phot_g_mean_mag',
'l','b',
'parallax, paralla... | python | {
"resource": ""
} |
q258848 | objectid_search | validation | def objectid_search(gaiaid,
gaia_mirror=None,
columns=('source_id',
'ra','dec',
'phot_g_mean_mag',
'phot_bp_mean_mag',
'phot_rp_mean_mag',
... | python | {
"resource": ""
} |
q258849 | generalized_lsp_value_notau | validation | def generalized_lsp_value_notau(times, mags, errs, omega):
'''
This is the simplified version not using tau.
The relations used are::
W = sum (1.0/(errs*errs) )
w_i = (1/W)*(1/(errs*errs))
Y = sum( w_i*y_i )
C = sum( w_i*cos(wt_i) )
S = sum( w_i*sin(wt_i) )
... | python | {
"resource": ""
} |
q258850 | specwindow_lsp_value | validation | def specwindow_lsp_value(times, mags, errs, omega):
'''This calculates the peak associated with the spectral window function
for times and at the specified omega.
NOTE: this is classical Lomb-Scargle, not the Generalized
Lomb-Scargle. `mags` and `errs` are silently ignored since we're calculating
t... | python | {
"resource": ""
} |
q258851 | specwindow_lsp | validation | def specwindow_lsp(
times,
mags,
errs,
magsarefluxes=False,
startp=None,
endp=None,
stepsize=1.0e-4,
autofreq=True,
nbestpeaks=5,
periodepsilon=0.1,
sigclip=10.0,
nworkers=None,
glspfunc=_glsp_worker_specwindow,
... | python | {
"resource": ""
} |
q258852 | check_existing_apikey | validation | def check_existing_apikey(lcc_server):
'''This validates if an API key for the specified LCC-Server is available.
API keys are stored using the following file scheme::
~/.astrobase/lccs/apikey-domain.of.lccserver.org
e.g. for the HAT LCC-Server at https://data.hatsurveys.org::
~/.astroba... | python | {
"resource": ""
} |
q258853 | get_new_apikey | validation | def get_new_apikey(lcc_server):
'''This gets a new API key from the specified LCC-Server.
NOTE: this only gets an anonymous API key. To get an API key tied to a user
account (and associated privilege level), see the `import_apikey` function
below.
Parameters
----------
lcc_server : str
... | python | {
"resource": ""
} |
q258854 | import_apikey | validation | def import_apikey(lcc_server, apikey_text_json):
'''This imports an API key from text and writes it to the cache dir.
Use this with the JSON text copied from the API key text box on your
LCC-Server user home page. The API key will thus be tied to the privileges
of that user account and can then access ... | python | {
"resource": ""
} |
q258855 | submit_post_searchquery | validation | def submit_post_searchquery(url, data, apikey):
'''This submits a POST query to an LCC-Server search API endpoint.
Handles streaming of the results, and returns the final JSON stream. Also
handles results that time out.
Parameters
----------
url : str
The URL of the search API endpoin... | python | {
"resource": ""
} |
q258856 | cone_search | validation | def cone_search(lcc_server,
center_ra,
center_decl,
radiusarcmin=5.0,
result_visibility='unlisted',
email_when_done=False,
collections=None,
columns=None,
filters=None,
sortspe... | python | {
"resource": ""
} |
q258857 | xmatch_search | validation | def xmatch_search(lcc_server,
file_to_upload,
xmatch_dist_arcsec=3.0,
result_visibility='unlisted',
email_when_done=False,
collections=None,
columns=None,
filters=None,
sortspe... | python | {
"resource": ""
} |
q258858 | get_dataset | validation | def get_dataset(lcc_server,
dataset_id,
strformat=False,
page=1):
'''This downloads a JSON form of a dataset from the specified lcc_server.
If the dataset contains more than 1000 rows, it will be paginated, so you
must use the `page` kwarg to get the page you... | python | {
"resource": ""
} |
q258859 | object_info | validation | def object_info(lcc_server, objectid, db_collection_id):
'''This gets information on a single object from the LCC-Server.
Returns a dict with all of the available information on an object, including
finding charts, comments, object type and variability tags, and
period-search results (if available).
... | python | {
"resource": ""
} |
q258860 | list_recent_datasets | validation | def list_recent_datasets(lcc_server, nrecent=25):
'''This lists recent publicly visible datasets available on the LCC-Server.
If you have an LCC-Server API key present in `~/.astrobase/lccs/` that is
associated with an LCC-Server user account, datasets that belong to this
user will be returned as well,... | python | {
"resource": ""
} |
q258861 | list_lc_collections | validation | def list_lc_collections(lcc_server):
'''This lists all light curve collections made available on the LCC-Server.
If you have an LCC-Server API key present in `~/.astrobase/lccs/` that is
associated with an LCC-Server user account, light curve collections visible
to this user will be returned as well, e... | python | {
"resource": ""
} |
q258862 | stetson_jindex | validation | def stetson_jindex(ftimes, fmags, ferrs, weightbytimediff=False):
'''This calculates the Stetson index for the magseries, based on consecutive
pairs of observations.
Based on Nicole Loncke's work for her Planets and Life certificate at
Princeton in 2014.
Parameters
----------
ftimes,fmags... | python | {
"resource": ""
} |
q258863 | lightcurve_moments | validation | def lightcurve_moments(ftimes, fmags, ferrs):
'''This calculates the weighted mean, stdev, median, MAD, percentiles, skew,
kurtosis, fraction of LC beyond 1-stdev, and IQR.
Parameters
----------
ftimes,fmags,ferrs : np.array
The input mag/flux time-series with all non-finite elements remov... | python | {
"resource": ""
} |
q258864 | lightcurve_flux_measures | validation | def lightcurve_flux_measures(ftimes, fmags, ferrs, magsarefluxes=False):
'''This calculates percentiles and percentile ratios of the flux.
Parameters
----------
ftimes,fmags,ferrs : np.array
The input mag/flux time-series with all non-finite elements removed.
magsarefluxes : bool
... | python | {
"resource": ""
} |
q258865 | all_nonperiodic_features | validation | def all_nonperiodic_features(times, mags, errs,
magsarefluxes=False,
stetson_weightbytimediff=True):
'''This rolls up the feature functions above and returns a single dict.
NOTE: this doesn't calculate the CDPP to save time since binning and
smoothi... | python | {
"resource": ""
} |
q258866 | _bls_runner | validation | def _bls_runner(times,
mags,
nfreq,
freqmin,
stepsize,
nbins,
minduration,
maxduration):
'''This runs the pyeebls.eebls function using the given inputs.
Parameters
----------
times,mags : np... | python | {
"resource": ""
} |
q258867 | _parallel_bls_worker | validation | def _parallel_bls_worker(task):
'''
This wraps the BLS function for the parallel driver below.
Parameters
----------
tasks : tuple
This is of the form::
task[0] = times
task[1] = mags
task[2] = nfreq
task[3] = freqmin
task[4] = s... | python | {
"resource": ""
} |
q258868 | bls_stats_singleperiod | validation | def bls_stats_singleperiod(times, mags, errs, period,
magsarefluxes=False,
sigclip=10.0,
perioddeltapercent=10,
nphasebins=200,
mintransitduration=0.01,
maxtr... | python | {
"resource": ""
} |
q258869 | massradius | validation | def massradius(age, planetdist, coremass,
mass='massjupiter',
radius='radiusjupiter'):
'''This function gets the Fortney mass-radius relation for planets.
Parameters
----------
age : float
This should be one of: 0.3, 1.0, 4.5 [in Gyr].
planetdist : float
... | python | {
"resource": ""
} |
q258870 | _reform_templatelc_for_tfa | validation | def _reform_templatelc_for_tfa(task):
'''
This is a parallel worker that reforms light curves for TFA.
task[0] = lcfile
task[1] = lcformat
task[2] = lcformatdir
task[3] = timecol
task[4] = magcol
task[5] = errcol
task[6] = timebase
task[7] = interpolate_type
task[8] = sigcli... | python | {
"resource": ""
} |
q258871 | parallel_tfa_lclist | validation | def parallel_tfa_lclist(lclist,
templateinfo,
timecols=None,
magcols=None,
errcols=None,
lcformat='hat-sql',
lcformatdir=None,
interp='nearest',
... | python | {
"resource": ""
} |
q258872 | parallel_tfa_lcdir | validation | def parallel_tfa_lcdir(lcdir,
templateinfo,
lcfileglob=None,
timecols=None,
magcols=None,
errcols=None,
lcformat='hat-sql',
lcformatdir=None,
... | python | {
"resource": ""
} |
q258873 | _read_pklc | validation | def _read_pklc(lcfile):
'''
This just reads a light curve pickle file.
Parameters
----------
lcfile : str
The file name of the pickle to open.
Returns
-------
dict
This returns an lcdict.
'''
if lcfile.endswith('.gz'):
try:
with gzip.ope... | python | {
"resource": ""
} |
q258874 | _check_extmodule | validation | def _check_extmodule(module, formatkey):
'''This imports the module specified.
Used to dynamically import Python modules that are needed to support LC
formats not natively supported by astrobase.
Parameters
----------
module : str
This is either:
- a Python module import path... | python | {
"resource": ""
} |
q258875 | register_lcformat | validation | def register_lcformat(formatkey,
fileglob,
timecols,
magcols,
errcols,
readerfunc_module,
readerfunc,
readerfunc_kwargs=None,
normfunc_module=No... | python | {
"resource": ""
} |
q258876 | ec2_ssh | validation | def ec2_ssh(ip_address,
keypem_file,
username='ec2-user',
raiseonfail=False):
"""This opens an SSH connection to the EC2 instance at `ip_address`.
Parameters
----------
ip_address : str
IP address of the AWS EC2 instance to connect to.
keypem_file : str... | python | {
"resource": ""
} |
q258877 | s3_get_file | validation | def s3_get_file(bucket,
filename,
local_file,
altexts=None,
client=None,
raiseonfail=False):
"""This gets a file from an S3 bucket.
Parameters
----------
bucket : str
The AWS S3 bucket name.
filename : str
... | python | {
"resource": ""
} |
q258878 | s3_put_file | validation | def s3_put_file(local_file, bucket, client=None, raiseonfail=False):
"""This uploads a file to S3.
Parameters
----------
local_file : str
Path to the file to upload to S3.
bucket : str
The AWS S3 bucket to upload the file to.
client : boto3.Client or None
If None, thi... | python | {
"resource": ""
} |
q258879 | s3_delete_file | validation | def s3_delete_file(bucket, filename, client=None, raiseonfail=False):
"""This deletes a file from S3.
Parameters
----------
bucket : str
The AWS S3 bucket to delete the file from.
filename : str
The full file name of the file to delete, including any prefixes.
client : boto3.... | python | {
"resource": ""
} |
q258880 | sqs_create_queue | validation | def sqs_create_queue(queue_name, options=None, client=None):
"""
This creates an SQS queue.
Parameters
----------
queue_name : str
The name of the queue to create.
options : dict or None
A dict of options indicate extra attributes the queue should have.
See the SQS doc... | python | {
"resource": ""
} |
q258881 | sqs_delete_queue | validation | def sqs_delete_queue(queue_url, client=None):
"""This deletes an SQS queue given its URL
Parameters
----------
queue_url : str
The SQS URL of the queue to delete.
client : boto3.Client or None
If None, this function will instantiate a new `boto3.Client` object to
use in it... | python | {
"resource": ""
} |
q258882 | sqs_put_item | validation | def sqs_put_item(queue_url,
item,
delay_seconds=0,
client=None,
raiseonfail=False):
"""This pushes a dict serialized to JSON to the specified SQS queue.
Parameters
----------
queue_url : str
The SQS URL of the queue to push th... | python | {
"resource": ""
} |
q258883 | sqs_get_item | validation | def sqs_get_item(queue_url,
max_items=1,
wait_time_seconds=5,
client=None,
raiseonfail=False):
"""This gets a single item from the SQS queue.
The `queue_url` is composed of some internal SQS junk plus a
`queue_name`. For our purposes (`lcp... | python | {
"resource": ""
} |
q258884 | sqs_delete_item | validation | def sqs_delete_item(queue_url,
receipt_handle,
client=None,
raiseonfail=False):
"""This deletes a message from the queue, effectively acknowledging its
receipt.
Call this only when all messages retrieved from the queue have been
processed, sin... | python | {
"resource": ""
} |
q258885 | delete_ec2_nodes | validation | def delete_ec2_nodes(
instance_id_list,
client=None
):
"""This deletes EC2 nodes and terminates the instances.
Parameters
----------
instance_id_list : list of str
A list of EC2 instance IDs to terminate.
client : boto3.Client or None
If None, this function will in... | python | {
"resource": ""
} |
q258886 | delete_spot_fleet_cluster | validation | def delete_spot_fleet_cluster(
spot_fleet_reqid,
client=None,
):
"""
This deletes a spot-fleet cluster.
Parameters
----------
spot_fleet_reqid : str
The fleet request ID returned by `make_spot_fleet_cluster`.
client : boto3.Client or None
If None, this function... | python | {
"resource": ""
} |
q258887 | gcs_put_file | validation | def gcs_put_file(local_file,
bucketname,
service_account_json=None,
client=None,
raiseonfail=False):
"""This puts a single file into a Google Cloud Storage bucket.
Parameters
----------
local_file : str
Path to the file to upl... | python | {
"resource": ""
} |
q258888 | read_fakelc | validation | def read_fakelc(fakelcfile):
'''
This just reads a pickled fake LC.
Parameters
----------
fakelcfile : str
The fake LC file to read.
Returns
-------
dict
This returns an lcdict.
'''
try:
with open(fakelcfile,'rb') as infd:
lcdict = pickle... | python | {
"resource": ""
} |
q258889 | get_varfeatures | validation | def get_varfeatures(simbasedir,
mindet=1000,
nworkers=None):
'''This runs `lcproc.lcvfeatures.parallel_varfeatures` on fake LCs in
`simbasedir`.
Parameters
----------
simbasedir : str
The directory containing the fake LCs to process.
mindet : in... | python | {
"resource": ""
} |
q258890 | precision | validation | def precision(ntp, nfp):
'''
This calculates precision.
https://en.wikipedia.org/wiki/Precision_and_recall
Parameters
----------
ntp : int
The number of true positives.
nfp : int
The number of false positives.
Returns
-------
float
The precision calc... | python | {
"resource": ""
} |
q258891 | recall | validation | def recall(ntp, nfn):
'''
This calculates recall.
https://en.wikipedia.org/wiki/Precision_and_recall
Parameters
----------
ntp : int
The number of true positives.
nfn : int
The number of false negatives.
Returns
-------
float
The precision calculated... | python | {
"resource": ""
} |
q258892 | matthews_correl_coeff | validation | def matthews_correl_coeff(ntp, ntn, nfp, nfn):
'''
This calculates the Matthews correlation coefficent.
https://en.wikipedia.org/wiki/Matthews_correlation_coefficient
Parameters
----------
ntp : int
The number of true positives.
ntn : int
The number of true negatives
... | python | {
"resource": ""
} |
q258893 | magbin_varind_gridsearch_worker | validation | def magbin_varind_gridsearch_worker(task):
'''
This is a parallel grid search worker for the function below.
'''
simbasedir, gridpoint, magbinmedian = task
try:
res = get_recovered_variables_for_magbin(simbasedir,
magbinmedian,
... | python | {
"resource": ""
} |
q258894 | variable_index_gridsearch_magbin | validation | def variable_index_gridsearch_magbin(simbasedir,
stetson_stdev_range=(1.0,20.0),
inveta_stdev_range=(1.0,20.0),
iqr_stdev_range=(1.0,20.0),
ngridpoints=32,
... | python | {
"resource": ""
} |
q258895 | run_periodfinding | validation | def run_periodfinding(simbasedir,
pfmethods=('gls','pdm','bls'),
pfkwargs=({},{},{'startp':1.0,'maxtransitduration':0.3}),
getblssnr=False,
sigclip=5.0,
nperiodworkers=10,
ncontrolworkers=... | python | {
"resource": ""
} |
q258896 | periodrec_worker | validation | def periodrec_worker(task):
'''This is a parallel worker for running period-recovery.
Parameters
----------
task : tuple
This is used to pass args to the `periodicvar_recovery` function::
task[0] = period-finding result pickle to work on
task[1] = simbasedir
... | python | {
"resource": ""
} |
q258897 | parallel_periodicvar_recovery | validation | def parallel_periodicvar_recovery(simbasedir,
period_tolerance=1.0e-3,
liststartind=None,
listmaxobjects=None,
nworkers=None):
'''This is a parallel driver for `periodicvar_recover... | python | {
"resource": ""
} |
q258898 | tic_conesearch | validation | def tic_conesearch(
ra,
decl,
radius_arcmin=5.0,
apiversion='v0',
forcefetch=False,
cachedir='~/.astrobase/mast-cache',
verbose=True,
timeout=10.0,
refresh=5.0,
maxtimeout=90.0,
maxtries=3,
jitter=5.0,
raiseonfail=Fa... | python | {
"resource": ""
} |
q258899 | tic_xmatch | validation | def tic_xmatch(
ra,
decl,
radius_arcsec=5.0,
apiversion='v0',
forcefetch=False,
cachedir='~/.astrobase/mast-cache',
verbose=True,
timeout=90.0,
refresh=5.0,
maxtimeout=180.0,
maxtries=3,
jitter=5.0,
raiseonfail=False... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.