partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | parallel_pf | This drives the overall parallel period processing for a list of LCs.
As a rough benchmark, 25000 HATNet light curves with up to 50000 points per
LC take about 26 days in total for an invocation of this function using
GLS+PDM+BLS, 10 periodworkers, and 4 controlworkers (so all 40 'cores') on a
2 x Xeon... | astrobase/lcproc/periodsearch.py | def parallel_pf(lclist,
outdir,
timecols=None,
magcols=None,
errcols=None,
lcformat='hat-sql',
lcformatdir=None,
pfmethods=('gls','pdm','mav','win'),
pfkwargs=({},{},{},{}),
si... | def parallel_pf(lclist,
outdir,
timecols=None,
magcols=None,
errcols=None,
lcformat='hat-sql',
lcformatdir=None,
pfmethods=('gls','pdm','mav','win'),
pfkwargs=({},{},{},{}),
si... | [
"This",
"drives",
"the",
"overall",
"parallel",
"period",
"processing",
"for",
"a",
"list",
"of",
"LCs",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/periodsearch.py#L493-L646 | [
"def",
"parallel_pf",
"(",
"lclist",
",",
"outdir",
",",
"timecols",
"=",
"None",
",",
"magcols",
"=",
"None",
",",
"errcols",
"=",
"None",
",",
"lcformat",
"=",
"'hat-sql'",
",",
"lcformatdir",
"=",
"None",
",",
"pfmethods",
"=",
"(",
"'gls'",
",",
"'... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | parallel_pf_lcdir | This runs parallel light curve period finding for directory of LCs.
Parameters
----------
lcdir : str
The directory containing the LCs to process.
outdir : str
The directory where the resulting period-finding pickles will go.
fileglob : str or None
The UNIX file glob to u... | astrobase/lcproc/periodsearch.py | def parallel_pf_lcdir(lcdir,
outdir,
fileglob=None,
recursive=True,
timecols=None,
magcols=None,
errcols=None,
lcformat='hat-sql',
lcformatdir=N... | def parallel_pf_lcdir(lcdir,
outdir,
fileglob=None,
recursive=True,
timecols=None,
magcols=None,
errcols=None,
lcformat='hat-sql',
lcformatdir=N... | [
"This",
"runs",
"parallel",
"light",
"curve",
"period",
"finding",
"for",
"directory",
"of",
"LCs",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/periodsearch.py#L650-L865 | [
"def",
"parallel_pf_lcdir",
"(",
"lcdir",
",",
"outdir",
",",
"fileglob",
"=",
"None",
",",
"recursive",
"=",
"True",
",",
"timecols",
"=",
"None",
",",
"magcols",
"=",
"None",
",",
"errcols",
"=",
"None",
",",
"lcformat",
"=",
"'hat-sql'",
",",
"lcforma... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | collect_nonperiodic_features | This collects variability features into arrays for use with the classifer.
Parameters
----------
featuresdir : str
This is the directory where all the varfeatures pickles are. Use
`pklglob` to specify the glob to search for. The `varfeatures` pickles
contain objectids, a light curv... | astrobase/varclass/rfclass.py | 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... | 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... | [
"This",
"collects",
"variability",
"features",
"into",
"arrays",
"for",
"use",
"with",
"the",
"classifer",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varclass/rfclass.py#L147-L321 | [
"def",
"collect_nonperiodic_features",
"(",
"featuresdir",
",",
"magcol",
",",
"outfile",
",",
"pklglob",
"=",
"'varfeatures-*.pkl'",
",",
"featurestouse",
"=",
"NONPERIODIC_FEATURES_TO_COLLECT",
",",
"maxobjects",
"=",
"None",
",",
"labeldict",
"=",
"None",
",",
"l... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | train_rf_classifier | This gets the best RF classifier after running cross-validation.
- splits the training set into test/train samples
- does `KFold` stratified cross-validation using `RandomizedSearchCV`
- gets the `RandomForestClassifier` with the best performance after CV
- gets the confusion matrix for the test set
... | astrobase/varclass/rfclass.py | 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... | 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... | [
"This",
"gets",
"the",
"best",
"RF",
"classifier",
"after",
"running",
"cross",
"-",
"validation",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varclass/rfclass.py#L329-L508 | [
"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",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | apply_rf_classifier | This applys an RF classifier trained using `train_rf_classifier`
to varfeatures pickles in `varfeaturesdir`.
Parameters
----------
classifier : dict or str
This is the output dict or pickle created by `get_rf_classifier`. This
will contain a `features_name` key that will be used to col... | astrobase/varclass/rfclass.py | 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 ... | 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 ... | [
"This",
"applys",
"an",
"RF",
"classifier",
"trained",
"using",
"train_rf_classifier",
"to",
"varfeatures",
"pickles",
"in",
"varfeaturesdir",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varclass/rfclass.py#L512-L611 | [
"def",
"apply_rf_classifier",
"(",
"classifier",
",",
"varfeaturesdir",
",",
"outpickle",
",",
"maxobjects",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"classifier",
",",
"str",
")",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"classifier",
")",
":"... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | plot_training_results | 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:
http://scikit-learn.org/stable/modules/learning_curve.html
Parameters
----------
classifier : dict ... | astrobase/varclass/rfclass.py | 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:... | 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:... | [
"This",
"plots",
"the",
"training",
"results",
"from",
"the",
"classifier",
"run",
"on",
"the",
"training",
"set",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varclass/rfclass.py#L619-L726 | [
"def",
"plot_training_results",
"(",
"classifier",
",",
"classlabels",
",",
"outfile",
")",
":",
"if",
"isinstance",
"(",
"classifier",
",",
"str",
")",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"classifier",
")",
":",
"with",
"open",
"(",
"classifier"... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _fourier_func | 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, ..., amplitude_X],
[phase_1, phase_2, phase_3, ...... | astrobase/lcfit/sinusoidal.py | 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... | 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... | [
"This",
"returns",
"a",
"summed",
"Fourier",
"cosine",
"series",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcfit/sinusoidal.py#L63-L111 | [
"def",
"_fourier_func",
"(",
"fourierparams",
",",
"phase",
",",
"mags",
")",
":",
"# figure out the order from the length of the Fourier param list",
"order",
"=",
"int",
"(",
"len",
"(",
"fourierparams",
")",
"/",
"2",
")",
"# get the amplitude and phase coefficients",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _fourier_chisq | 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. | astrobase/lcfit/sinusoidal.py | 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... | 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... | [
"This",
"is",
"the",
"chisq",
"objective",
"function",
"to",
"be",
"minimized",
"by",
"scipy",
".",
"minimize",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcfit/sinusoidal.py#L115-L129 | [
"def",
"_fourier_chisq",
"(",
"fourierparams",
",",
"phase",
",",
"mags",
",",
"errs",
")",
":",
"f",
"=",
"_fourier_func",
"(",
"fourierparams",
",",
"phase",
",",
"mags",
")",
"chisq",
"=",
"npsum",
"(",
"(",
"(",
"mags",
"-",
"f",
")",
"*",
"(",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _fourier_residual | This is the residual objective function to be minimized by `scipy.leastsq`.
The parameters are the same as `_fourier_func` above. | astrobase/lcfit/sinusoidal.py | 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... | 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... | [
"This",
"is",
"the",
"residual",
"objective",
"function",
"to",
"be",
"minimized",
"by",
"scipy",
".",
"leastsq",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcfit/sinusoidal.py#L133-L146 | [
"def",
"_fourier_residual",
"(",
"fourierparams",
",",
"phase",
",",
"mags",
")",
":",
"f",
"=",
"_fourier_func",
"(",
"fourierparams",
",",
"phase",
",",
"mags",
")",
"residual",
"=",
"mags",
"-",
"f",
"return",
"residual"
] | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | fourier_fit_magseries | This fits a Fourier series to a mag/flux time series.
Parameters
----------
times,mags,errs : np.array
The input mag/flux time-series to fit a Fourier cosine series to.
period : float
The period to use for the Fourier fit.
fourierorder : None or int
If this is an int, wil... | astrobase/lcfit/sinusoidal.py | def fourier_fit_magseries(times, mags, errs, period,
fourierorder=None,
fourierparams=None,
sigclip=3.0,
magsarefluxes=False,
plotfit=False,
ignoreinitfail=True,
... | def fourier_fit_magseries(times, mags, errs, period,
fourierorder=None,
fourierparams=None,
sigclip=3.0,
magsarefluxes=False,
plotfit=False,
ignoreinitfail=True,
... | [
"This",
"fits",
"a",
"Fourier",
"series",
"to",
"a",
"mag",
"/",
"flux",
"time",
"series",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcfit/sinusoidal.py#L150-L441 | [
"def",
"fourier_fit_magseries",
"(",
"times",
",",
"mags",
",",
"errs",
",",
"period",
",",
"fourierorder",
"=",
"None",
",",
"fourierparams",
"=",
"None",
",",
"sigclip",
"=",
"3.0",
",",
"magsarefluxes",
"=",
"False",
",",
"plotfit",
"=",
"False",
",",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | plot_magseries | This plots a magnitude/flux time-series.
Parameters
----------
times,mags : np.array
The mag/flux time-series to plot as a function of time.
magsarefluxes : bool
Indicates if the input `mags` array is actually an array of flux
measurements instead of magnitude measurements. If... | astrobase/plotbase.py | def plot_magseries(times,
mags,
magsarefluxes=False,
errs=None,
out=None,
sigclip=30.0,
normto='globalmedian',
normmingap=4.0,
timebin=None,
yrange=N... | def plot_magseries(times,
mags,
magsarefluxes=False,
errs=None,
out=None,
sigclip=30.0,
normto='globalmedian',
normmingap=4.0,
timebin=None,
yrange=N... | [
"This",
"plots",
"a",
"magnitude",
"/",
"flux",
"time",
"-",
"series",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/plotbase.py#L97-L443 | [
"def",
"plot_magseries",
"(",
"times",
",",
"mags",
",",
"magsarefluxes",
"=",
"False",
",",
"errs",
"=",
"None",
",",
"out",
"=",
"None",
",",
"sigclip",
"=",
"30.0",
",",
"normto",
"=",
"'globalmedian'",
",",
"normmingap",
"=",
"4.0",
",",
"timebin",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | plot_phased_magseries | Plots a phased magnitude/flux time-series using the period provided.
Parameters
----------
times,mags : np.array
The mag/flux time-series to plot as a function of phase given `period`.
period : float
The period to use to phase-fold the time-series. Should be the same unit
as `... | astrobase/plotbase.py | def plot_phased_magseries(times,
mags,
period,
epoch='min',
fitknotfrac=0.01,
errs=None,
magsarefluxes=False,
normto='globalmedian',
... | def plot_phased_magseries(times,
mags,
period,
epoch='min',
fitknotfrac=0.01,
errs=None,
magsarefluxes=False,
normto='globalmedian',
... | [
"Plots",
"a",
"phased",
"magnitude",
"/",
"flux",
"time",
"-",
"series",
"using",
"the",
"period",
"provided",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/plotbase.py#L451-L861 | [
"def",
"plot_phased_magseries",
"(",
"times",
",",
"mags",
",",
"period",
",",
"epoch",
"=",
"'min'",
",",
"fitknotfrac",
"=",
"0.01",
",",
"errs",
"=",
"None",
",",
"magsarefluxes",
"=",
"False",
",",
"normto",
"=",
"'globalmedian'",
",",
"normmingap",
"=... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | skyview_stamp | This downloads a DSS FITS stamp centered on the coordinates specified.
This wraps the function :py:func:`astrobase.services.skyview.get_stamp`,
which downloads Digitized Sky Survey stamps in FITS format from the NASA
SkyView service:
https://skyview.gsfc.nasa.gov/current/cgi/query.pl
Also adds so... | astrobase/plotbase.py | 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... | 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... | [
"This",
"downloads",
"a",
"DSS",
"FITS",
"stamp",
"centered",
"on",
"the",
"coordinates",
"specified",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/plotbase.py#L869-L1010 | [
"def",
"skyview_stamp",
"(",
"ra",
",",
"decl",
",",
"survey",
"=",
"'DSS2 Red'",
",",
"scaling",
"=",
"'Linear'",
",",
"flip",
"=",
"True",
",",
"convolvewith",
"=",
"None",
",",
"forcefetch",
"=",
"False",
",",
"cachedir",
"=",
"'~/.astrobase/stamp-cache'"... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | fits_finder_chart | This makes a finder chart for a given FITS with an optional object
position overlay.
Parameters
----------
fitsfile : str
`fitsfile` is the FITS file to use to make the finder chart.
outfile : str
`outfile` is the name of the output file. This can be a png or pdf or
whatev... | astrobase/plotbase.py | def fits_finder_chart(
fitsfile,
outfile,
fitsext=0,
wcsfrom=None,
scale=ZScaleInterval(),
stretch=LinearStretch(),
colormap=plt.cm.gray_r,
findersize=None,
finder_coordlimits=None,
overlay_ra=None,
overlay_decl=None,
overla... | def fits_finder_chart(
fitsfile,
outfile,
fitsext=0,
wcsfrom=None,
scale=ZScaleInterval(),
stretch=LinearStretch(),
colormap=plt.cm.gray_r,
findersize=None,
finder_coordlimits=None,
overlay_ra=None,
overlay_decl=None,
overla... | [
"This",
"makes",
"a",
"finder",
"chart",
"for",
"a",
"given",
"FITS",
"with",
"an",
"optional",
"object",
"position",
"overlay",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/plotbase.py#L1014-L1258 | [
"def",
"fits_finder_chart",
"(",
"fitsfile",
",",
"outfile",
",",
"fitsext",
"=",
"0",
",",
"wcsfrom",
"=",
"None",
",",
"scale",
"=",
"ZScaleInterval",
"(",
")",
",",
"stretch",
"=",
"LinearStretch",
"(",
")",
",",
"colormap",
"=",
"plt",
".",
"cm",
"... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | plot_periodbase_lsp | 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.
Parameters
----------
lspinfo : dict or str
If lspinfo ... | astrobase/plotbase.py | 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... | 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... | [
"Makes",
"a",
"plot",
"of",
"periodograms",
"obtained",
"from",
"periodbase",
"functions",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/plotbase.py#L1294-L1414 | [
"def",
"plot_periodbase_lsp",
"(",
"lspinfo",
",",
"outfile",
"=",
"None",
",",
"plotdpi",
"=",
"100",
")",
":",
"# get the lspinfo from a pickle file transparently",
"if",
"isinstance",
"(",
"lspinfo",
",",
"str",
")",
"and",
"os",
".",
"path",
".",
"exists",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | read_hatpi_textlc | This reads in a textlc that is complete up to the TFA stage. | astrobase/hatsurveys/hplc.py | def read_hatpi_textlc(lcfile):
'''
This reads in a textlc that is complete up to the TFA stage.
'''
if 'TF1' in lcfile:
thiscoldefs = COLDEFS + [('itf1',float)]
elif 'TF2' in lcfile:
thiscoldefs = COLDEFS + [('itf2',float)]
elif 'TF3' in lcfile:
thiscoldefs = COLDEFS + ... | def read_hatpi_textlc(lcfile):
'''
This reads in a textlc that is complete up to the TFA stage.
'''
if 'TF1' in lcfile:
thiscoldefs = COLDEFS + [('itf1',float)]
elif 'TF2' in lcfile:
thiscoldefs = COLDEFS + [('itf2',float)]
elif 'TF3' in lcfile:
thiscoldefs = COLDEFS + ... | [
"This",
"reads",
"in",
"a",
"textlc",
"that",
"is",
"complete",
"up",
"to",
"the",
"TFA",
"stage",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L123-L203 | [
"def",
"read_hatpi_textlc",
"(",
"lcfile",
")",
":",
"if",
"'TF1'",
"in",
"lcfile",
":",
"thiscoldefs",
"=",
"COLDEFS",
"+",
"[",
"(",
"'itf1'",
",",
"float",
")",
"]",
"elif",
"'TF2'",
"in",
"lcfile",
":",
"thiscoldefs",
"=",
"COLDEFS",
"+",
"[",
"(",... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | lcdict_to_pickle | 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'. | astrobase/hatsurveys/hplc.py | 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... | 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... | [
"This",
"just",
"writes",
"the",
"lcdict",
"to",
"a",
"pickle",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L207-L230 | [
"def",
"lcdict_to_pickle",
"(",
"lcdict",
",",
"outfile",
"=",
"None",
")",
":",
"if",
"not",
"outfile",
"and",
"lcdict",
"[",
"'objectid'",
"]",
":",
"outfile",
"=",
"'%s-hplc.pkl'",
"%",
"lcdict",
"[",
"'objectid'",
"]",
"elif",
"not",
"outfile",
"and",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | read_hatpi_pklc | This just reads a pickle LC. Returns an lcdict. | astrobase/hatsurveys/hplc.py | 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
... | 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
... | [
"This",
"just",
"reads",
"a",
"pickle",
"LC",
".",
"Returns",
"an",
"lcdict",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L234-L266 | [
"def",
"read_hatpi_pklc",
"(",
"lcfile",
")",
":",
"try",
":",
"if",
"lcfile",
".",
"endswith",
"(",
"'.gz'",
")",
":",
"infd",
"=",
"gzip",
".",
"open",
"(",
"lcfile",
",",
"'rb'",
")",
"else",
":",
"infd",
"=",
"open",
"(",
"lcfile",
",",
"'rb'",... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | concatenate_textlcs | 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 across CCDs or instrument
changes for a single object. These can then be normalized later using
standard astrob... | astrobase/hatsurveys/hplc.py | 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... | 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... | [
"This",
"concatenates",
"a",
"list",
"of",
"light",
"curves",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L274-L401 | [
"def",
"concatenate_textlcs",
"(",
"lclist",
",",
"sortby",
"=",
"'rjd'",
",",
"normalize",
"=",
"True",
")",
":",
"# read the first light curve",
"lcdict",
"=",
"read_hatpi_textlc",
"(",
"lclist",
"[",
"0",
"]",
")",
"# track which LC goes where",
"# initial LC",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | concatenate_textlcs_for_objectid | This concatenates all text LCs for an objectid with the given aperture.
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 across CCDs or instrument
changes for a single object. These can then be normalized l... | astrobase/hatsurveys/hplc.py | def concatenate_textlcs_for_objectid(lcbasedir,
objectid,
aperture='TF1',
postfix='.gz',
sortby='rjd',
normalize=True,
... | def concatenate_textlcs_for_objectid(lcbasedir,
objectid,
aperture='TF1',
postfix='.gz',
sortby='rjd',
normalize=True,
... | [
"This",
"concatenates",
"all",
"text",
"LCs",
"for",
"an",
"objectid",
"with",
"the",
"given",
"aperture",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L405-L502 | [
"def",
"concatenate_textlcs_for_objectid",
"(",
"lcbasedir",
",",
"objectid",
",",
"aperture",
"=",
"'TF1'",
",",
"postfix",
"=",
"'.gz'",
",",
"sortby",
"=",
"'rjd'",
",",
"normalize",
"=",
"True",
",",
"recursive",
"=",
"True",
")",
":",
"LOGINFO",
"(",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | concat_write_pklc | This concatenates all text LCs for the given object and writes to a pklc.
Basically a rollup for the concatenate_textlcs_for_objectid and
lcdict_to_pickle functions. | astrobase/hatsurveys/hplc.py | def concat_write_pklc(lcbasedir,
objectid,
aperture='TF1',
postfix='.gz',
sortby='rjd',
normalize=True,
outdir=None,
recursive=True):
'''This concatenates all tex... | def concat_write_pklc(lcbasedir,
objectid,
aperture='TF1',
postfix='.gz',
sortby='rjd',
normalize=True,
outdir=None,
recursive=True):
'''This concatenates all tex... | [
"This",
"concatenates",
"all",
"text",
"LCs",
"for",
"the",
"given",
"object",
"and",
"writes",
"to",
"a",
"pklc",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L506-L537 | [
"def",
"concat_write_pklc",
"(",
"lcbasedir",
",",
"objectid",
",",
"aperture",
"=",
"'TF1'",
",",
"postfix",
"=",
"'.gz'",
",",
"sortby",
"=",
"'rjd'",
",",
"normalize",
"=",
"True",
",",
"outdir",
"=",
"None",
",",
"recursive",
"=",
"True",
")",
":",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | parallel_concat_worker | This is a worker for the function below.
task[0] = lcbasedir
task[1] = objectid
task[2] = {'aperture','postfix','sortby','normalize','outdir','recursive'} | astrobase/hatsurveys/hplc.py | 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... | 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... | [
"This",
"is",
"a",
"worker",
"for",
"the",
"function",
"below",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L541-L558 | [
"def",
"parallel_concat_worker",
"(",
"task",
")",
":",
"lcbasedir",
",",
"objectid",
",",
"kwargs",
"=",
"task",
"try",
":",
"return",
"concat_write_pklc",
"(",
"lcbasedir",
",",
"objectid",
",",
"*",
"*",
"kwargs",
")",
"except",
"Exception",
"as",
"e",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | parallel_concat_lcdir | This concatenates all text LCs for the given objectidlist. | astrobase/hatsurveys/hplc.py | def parallel_concat_lcdir(lcbasedir,
objectidlist,
aperture='TF1',
postfix='.gz',
sortby='rjd',
normalize=True,
outdir=None,
recursive=Tru... | def parallel_concat_lcdir(lcbasedir,
objectidlist,
aperture='TF1',
postfix='.gz',
sortby='rjd',
normalize=True,
outdir=None,
recursive=Tru... | [
"This",
"concatenates",
"all",
"text",
"LCs",
"for",
"the",
"given",
"objectidlist",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L562-L596 | [
"def",
"parallel_concat_lcdir",
"(",
"lcbasedir",
",",
"objectidlist",
",",
"aperture",
"=",
"'TF1'",
",",
"postfix",
"=",
"'.gz'",
",",
"sortby",
"=",
"'rjd'",
",",
"normalize",
"=",
"True",
",",
"outdir",
"=",
"None",
",",
"recursive",
"=",
"True",
",",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | merge_hatpi_textlc_apertures | 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 format specified in COLDEFS above and readable
b... | astrobase/hatsurveys/hplc.py | 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... | 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... | [
"This",
"merges",
"all",
"TFA",
"text",
"LCs",
"with",
"separate",
"apertures",
"for",
"a",
"single",
"object",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L604-L632 | [
"def",
"merge_hatpi_textlc_apertures",
"(",
"lclist",
")",
":",
"lcaps",
"=",
"{",
"}",
"framekeys",
"=",
"[",
"]",
"for",
"lc",
"in",
"lclist",
":",
"lcd",
"=",
"read_hatpi_textlc",
"(",
"lc",
")",
"# figure what aperture this is and put it into the lcdict. if two ... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | read_hatpi_binnedlc | This reads a binnedlc pickle produced by the HATPI prototype pipeline.
Converts it into a standard lcdict as produced by the read_hatpi_textlc
function above by using the information in unbinnedtextlc for the same
object.
Adds a 'binned' key to the standard lcdict containing the binned mags, etc. | astrobase/hatsurveys/hplc.py | def read_hatpi_binnedlc(binnedpklf, textlcf, timebinsec):
'''This reads a binnedlc pickle produced by the HATPI prototype pipeline.
Converts it into a standard lcdict as produced by the read_hatpi_textlc
function above by using the information in unbinnedtextlc for the same
object.
Adds a 'binned'... | def read_hatpi_binnedlc(binnedpklf, textlcf, timebinsec):
'''This reads a binnedlc pickle produced by the HATPI prototype pipeline.
Converts it into a standard lcdict as produced by the read_hatpi_textlc
function above by using the information in unbinnedtextlc for the same
object.
Adds a 'binned'... | [
"This",
"reads",
"a",
"binnedlc",
"pickle",
"produced",
"by",
"the",
"HATPI",
"prototype",
"pipeline",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L642-L784 | [
"def",
"read_hatpi_binnedlc",
"(",
"binnedpklf",
",",
"textlcf",
",",
"timebinsec",
")",
":",
"LOGINFO",
"(",
"'reading binned LC %s'",
"%",
"binnedpklf",
")",
"# read the textlc",
"lcdict",
"=",
"read_hatpi_textlc",
"(",
"textlcf",
")",
"# read the binned LC",
"if",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | generate_hatpi_binnedlc_pkl | This reads the binned LC and writes it out to a pickle. | astrobase/hatsurveys/hplc.py | 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... | 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... | [
"This",
"reads",
"the",
"binned",
"LC",
"and",
"writes",
"it",
"out",
"to",
"a",
"pickle",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L788-L809 | [
"def",
"generate_hatpi_binnedlc_pkl",
"(",
"binnedpklf",
",",
"textlcf",
",",
"timebinsec",
",",
"outfile",
"=",
"None",
")",
":",
"binlcdict",
"=",
"read_hatpi_binnedlc",
"(",
"binnedpklf",
",",
"textlcf",
",",
"timebinsec",
")",
"if",
"binlcdict",
":",
"if",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | parallel_gen_binnedlc_pkls | This generates the binnedlc pkls for a directory of such files.
FIXME: finish this | astrobase/hatsurveys/hplc.py | 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... | 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... | [
"This",
"generates",
"the",
"binnedlc",
"pkls",
"for",
"a",
"directory",
"of",
"such",
"files",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L813-L841 | [
"def",
"parallel_gen_binnedlc_pkls",
"(",
"binnedpkldir",
",",
"textlcdir",
",",
"timebinsec",
",",
"binnedpklglob",
"=",
"'*binned*sec*.pkl'",
",",
"textlcglob",
"=",
"'*.tfalc.TF1*'",
")",
":",
"binnedpkls",
"=",
"sorted",
"(",
"glob",
".",
"glob",
"(",
"os",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | pklc_fovcatalog_objectinfo | Adds catalog info to objectinfo key of all pklcs in lcdir.
If fovcatalog, fovcatalog_columns, fovcatalog_colnames are provided, uses
them to find all the additional information listed in the fovcatalog_colname
keys, and writes this info to the objectinfo key of each lcdict. This makes
it easier for ast... | astrobase/hatsurveys/hplc.py | 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],
... | 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],
... | [
"Adds",
"catalog",
"info",
"to",
"objectinfo",
"key",
"of",
"all",
"pklcs",
"in",
"lcdir",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hplc.py#L850-L943 | [
"def",
"pklc_fovcatalog_objectinfo",
"(",
"pklcdir",
",",
"fovcatalog",
",",
"fovcatalog_columns",
"=",
"[",
"0",
",",
"1",
",",
"2",
",",
"6",
",",
"7",
",",
"8",
",",
"9",
",",
"10",
",",
"11",
",",
"13",
",",
"14",
",",
"15",
",",
"16",
",",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _base64_to_file | 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 should include an
appropriate extension for the file (e.g. a b... | astrobase/checkplot/pkl_io.py | 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... | 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... | [
"This",
"converts",
"the",
"base64",
"encoded",
"string",
"to",
"a",
"file",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/checkplot/pkl_io.py#L65-L122 | [
"def",
"_base64_to_file",
"(",
"b64str",
",",
"outfpath",
",",
"writetostrio",
"=",
"False",
")",
":",
"try",
":",
"filebytes",
"=",
"base64",
".",
"b64decode",
"(",
"b64str",
")",
"# if we're writing back to a stringio object",
"if",
"writetostrio",
":",
"outobj"... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _read_checkplot_picklefile | 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 workaround is noted in this answer:
http://stackoverflow.... | astrobase/checkplot/pkl_io.py | 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... | 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... | [
"This",
"reads",
"a",
"checkplot",
"gzipped",
"pickle",
"file",
"back",
"into",
"a",
"dict",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/checkplot/pkl_io.py#L130-L179 | [
"def",
"_read_checkplot_picklefile",
"(",
"checkplotpickle",
")",
":",
"if",
"checkplotpickle",
".",
"endswith",
"(",
"'.gz'",
")",
":",
"try",
":",
"with",
"gzip",
".",
"open",
"(",
"checkplotpickle",
",",
"'rb'",
")",
"as",
"infd",
":",
"cpdict",
"=",
"p... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _write_checkplot_picklefile | This writes the checkplotdict to a (gzipped) pickle file.
Parameters
----------
checkplotdict : dict
This the checkplotdict to write to the pickle file.
outfile : None or str
The path to the output pickle file to write. If `outfile` is None,
writes a (gzipped) pickle file of t... | astrobase/checkplot/pkl_io.py | def _write_checkplot_picklefile(checkplotdict,
outfile=None,
protocol=None,
outgzip=False):
'''This writes the checkplotdict to a (gzipped) pickle file.
Parameters
----------
checkplotdict : dict
T... | def _write_checkplot_picklefile(checkplotdict,
outfile=None,
protocol=None,
outgzip=False):
'''This writes the checkplotdict to a (gzipped) pickle file.
Parameters
----------
checkplotdict : dict
T... | [
"This",
"writes",
"the",
"checkplotdict",
"to",
"a",
"(",
"gzipped",
")",
"pickle",
"file",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/checkplot/pkl_io.py#L183-L287 | [
"def",
"_write_checkplot_picklefile",
"(",
"checkplotdict",
",",
"outfile",
"=",
"None",
",",
"protocol",
"=",
"None",
",",
"outgzip",
"=",
"False",
")",
":",
"# figure out which protocol to use",
"# for Python >= 3.4; use v4 by default",
"if",
"(",
"(",
"sys",
".",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | get_phased_quantities | Does phase-folding for the mag/flux time-series given a period.
Given finite and sigma-clipped times, magnitudes, and errors, along with the
period at which to phase-fold the data, perform the phase-folding and
return the phase-folded values.
Parameters
----------
stimes,smags,serrs : np.arra... | astrobase/lcfit/utils.py | def get_phased_quantities(stimes, smags, serrs, period):
'''Does phase-folding for the mag/flux time-series given a period.
Given finite and sigma-clipped times, magnitudes, and errors, along with the
period at which to phase-fold the data, perform the phase-folding and
return the phase-folded values.
... | def get_phased_quantities(stimes, smags, serrs, period):
'''Does phase-folding for the mag/flux time-series given a period.
Given finite and sigma-clipped times, magnitudes, and errors, along with the
period at which to phase-fold the data, perform the phase-folding and
return the phase-folded values.
... | [
"Does",
"phase",
"-",
"folding",
"for",
"the",
"mag",
"/",
"flux",
"time",
"-",
"series",
"given",
"a",
"period",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcfit/utils.py#L53-L104 | [
"def",
"get_phased_quantities",
"(",
"stimes",
",",
"smags",
",",
"serrs",
",",
"period",
")",
":",
"# phase the mag series using the given period and faintest mag time",
"# mintime = stimes[npwhere(smags == npmax(smags))]",
"# phase the mag series using the given period and epoch = min(... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | make_fit_plot | This makes a plot of the LC model fit.
Parameters
----------
phase,pmags,perrs : np.array
The actual mag/flux time-series.
fitmags : np.array
The model fit time-series.
period : float
The period at which the phased LC was generated.
mintime : float
The minimu... | astrobase/lcfit/utils.py | 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... | 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... | [
"This",
"makes",
"a",
"plot",
"of",
"the",
"LC",
"model",
"fit",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcfit/utils.py#L111-L219 | [
"def",
"make_fit_plot",
"(",
"phase",
",",
"pmags",
",",
"perrs",
",",
"fitmags",
",",
"period",
",",
"mintime",
",",
"magseriesepoch",
",",
"plotfit",
",",
"magsarefluxes",
"=",
"False",
",",
"wrap",
"=",
"False",
",",
"model_over_lc",
"=",
"False",
")",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | objectlist_conesearch | This queries the GAIA TAP service for a list of objects near the coords.
Runs a conesearch around `(racenter, declcenter)` with radius in arcsec of
`searchradiusarcsec`.
Parameters
----------
racenter,declcenter : float
The center equatorial coordinates in decimal degrees.
searchradi... | astrobase/services/gaia.py | def objectlist_conesearch(racenter,
declcenter,
searchradiusarcsec,
gaia_mirror=None,
columns=('source_id',
'ra','dec',
'phot_g_mean_mag',
... | def objectlist_conesearch(racenter,
declcenter,
searchradiusarcsec,
gaia_mirror=None,
columns=('source_id',
'ra','dec',
'phot_g_mean_mag',
... | [
"This",
"queries",
"the",
"GAIA",
"TAP",
"service",
"for",
"a",
"list",
"of",
"objects",
"near",
"the",
"coords",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/gaia.py#L835-L980 | [
"def",
"objectlist_conesearch",
"(",
"racenter",
",",
"declcenter",
",",
"searchradiusarcsec",
",",
"gaia_mirror",
"=",
"None",
",",
"columns",
"=",
"(",
"'source_id'",
",",
"'ra'",
",",
"'dec'",
",",
"'phot_g_mean_mag'",
",",
"'l'",
",",
"'b'",
",",
"'paralla... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | objectlist_radeclbox | This queries the GAIA TAP service for a list of objects in an equatorial
coordinate box.
Parameters
----------
radeclbox : sequence of four floats
This defines the box to search in::
[ra_min, ra_max, decl_min, decl_max]
gaia_mirror : {'gaia','heidelberg','vizier'} or None
... | astrobase/services/gaia.py | def objectlist_radeclbox(radeclbox,
gaia_mirror=None,
columns=('source_id',
'ra','dec',
'phot_g_mean_mag',
'l','b',
'parallax, paralla... | def objectlist_radeclbox(radeclbox,
gaia_mirror=None,
columns=('source_id',
'ra','dec',
'phot_g_mean_mag',
'l','b',
'parallax, paralla... | [
"This",
"queries",
"the",
"GAIA",
"TAP",
"service",
"for",
"a",
"list",
"of",
"objects",
"in",
"an",
"equatorial",
"coordinate",
"box",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/gaia.py#L984-L1126 | [
"def",
"objectlist_radeclbox",
"(",
"radeclbox",
",",
"gaia_mirror",
"=",
"None",
",",
"columns",
"=",
"(",
"'source_id'",
",",
"'ra'",
",",
"'dec'",
",",
"'phot_g_mean_mag'",
",",
"'l'",
",",
"'b'",
",",
"'parallax, parallax_error'",
",",
"'pmra'",
",",
"'pmr... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | objectid_search | This queries the GAIA TAP service for a single GAIA source ID.
Parameters
----------
gaiaid : str
The source ID of the object whose info will be collected.
gaia_mirror : {'gaia','heidelberg','vizier'} or None
This is the key used to select a GAIA catalog mirror from the
`GAIA_... | astrobase/services/gaia.py | def objectid_search(gaiaid,
gaia_mirror=None,
columns=('source_id',
'ra','dec',
'phot_g_mean_mag',
'phot_bp_mean_mag',
'phot_rp_mean_mag',
... | def objectid_search(gaiaid,
gaia_mirror=None,
columns=('source_id',
'ra','dec',
'phot_g_mean_mag',
'phot_bp_mean_mag',
'phot_rp_mean_mag',
... | [
"This",
"queries",
"the",
"GAIA",
"TAP",
"service",
"for",
"a",
"single",
"GAIA",
"source",
"ID",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/gaia.py#L1130-L1245 | [
"def",
"objectid_search",
"(",
"gaiaid",
",",
"gaia_mirror",
"=",
"None",
",",
"columns",
"=",
"(",
"'source_id'",
",",
"'ra'",
",",
"'dec'",
",",
"'phot_g_mean_mag'",
",",
"'phot_bp_mean_mag'",
",",
"'phot_rp_mean_mag'",
",",
"'l'",
",",
"'b'",
",",
"'paralla... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | generalized_lsp_value | Generalized LSP value for a single omega.
The relations used are::
P(w) = (1/YY) * (YC*YC/CC + YS*YS/SS)
where: YC, YS, CC, and SS are all calculated at T
and where: tan 2omegaT = 2*CS/(CC - SS)
and where:
Y = sum( w_i*y_i )
C = sum( w_i*cos(wT_i) )
S = ... | astrobase/periodbase/zgls.py | def generalized_lsp_value(times, mags, errs, omega):
'''Generalized LSP value for a single omega.
The relations used are::
P(w) = (1/YY) * (YC*YC/CC + YS*YS/SS)
where: YC, YS, CC, and SS are all calculated at T
and where: tan 2omegaT = 2*CS/(CC - SS)
and where:
Y = ... | def generalized_lsp_value(times, mags, errs, omega):
'''Generalized LSP value for a single omega.
The relations used are::
P(w) = (1/YY) * (YC*YC/CC + YS*YS/SS)
where: YC, YS, CC, and SS are all calculated at T
and where: tan 2omegaT = 2*CS/(CC - SS)
and where:
Y = ... | [
"Generalized",
"LSP",
"value",
"for",
"a",
"single",
"omega",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/zgls.py#L71-L157 | [
"def",
"generalized_lsp_value",
"(",
"times",
",",
"mags",
",",
"errs",
",",
"omega",
")",
":",
"one_over_errs2",
"=",
"1.0",
"/",
"(",
"errs",
"*",
"errs",
")",
"W",
"=",
"npsum",
"(",
"one_over_errs2",
")",
"wi",
"=",
"one_over_errs2",
"/",
"W",
"sin... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | generalized_lsp_value_withtau | Generalized LSP value for a single omega.
This uses tau to provide an arbitrary time-reference point.
The relations used are::
P(w) = (1/YY) * (YC*YC/CC + YS*YS/SS)
where: YC, YS, CC, and SS are all calculated at T
and where: tan 2omegaT = 2*CS/(CC - SS)
and where:
... | astrobase/periodbase/zgls.py | def generalized_lsp_value_withtau(times, mags, errs, omega):
'''Generalized LSP value for a single omega.
This uses tau to provide an arbitrary time-reference point.
The relations used are::
P(w) = (1/YY) * (YC*YC/CC + YS*YS/SS)
where: YC, YS, CC, and SS are all calculated at T
... | def generalized_lsp_value_withtau(times, mags, errs, omega):
'''Generalized LSP value for a single omega.
This uses tau to provide an arbitrary time-reference point.
The relations used are::
P(w) = (1/YY) * (YC*YC/CC + YS*YS/SS)
where: YC, YS, CC, and SS are all calculated at T
... | [
"Generalized",
"LSP",
"value",
"for",
"a",
"single",
"omega",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/zgls.py#L161-L265 | [
"def",
"generalized_lsp_value_withtau",
"(",
"times",
",",
"mags",
",",
"errs",
",",
"omega",
")",
":",
"one_over_errs2",
"=",
"1.0",
"/",
"(",
"errs",
"*",
"errs",
")",
"W",
"=",
"npsum",
"(",
"one_over_errs2",
")",
"wi",
"=",
"one_over_errs2",
"/",
"W"... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | generalized_lsp_value_notau | 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) )
YY = sum( w_i*y_i*y_i ) - Y*Y
YC = sum( w_i*y_i*cos(wt_i) ) -... | astrobase/periodbase/zgls.py | 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) )
... | 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) )
... | [
"This",
"is",
"the",
"simplified",
"version",
"not",
"using",
"tau",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/zgls.py#L269-L351 | [
"def",
"generalized_lsp_value_notau",
"(",
"times",
",",
"mags",
",",
"errs",
",",
"omega",
")",
":",
"one_over_errs2",
"=",
"1.0",
"/",
"(",
"errs",
"*",
"errs",
")",
"W",
"=",
"npsum",
"(",
"one_over_errs2",
")",
"wi",
"=",
"one_over_errs2",
"/",
"W",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | specwindow_lsp_value | 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
the periodogram of the observing window function. These are ... | astrobase/periodbase/zgls.py | 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... | 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... | [
"This",
"calculates",
"the",
"peak",
"associated",
"with",
"the",
"spectral",
"window",
"function",
"for",
"times",
"and",
"at",
"the",
"specified",
"omega",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/zgls.py#L355-L403 | [
"def",
"specwindow_lsp_value",
"(",
"times",
",",
"mags",
",",
"errs",
",",
"omega",
")",
":",
"norm_times",
"=",
"times",
"-",
"times",
".",
"min",
"(",
")",
"tau",
"=",
"(",
"(",
"1.0",
"/",
"(",
"2.0",
"*",
"omega",
")",
")",
"*",
"nparctan",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | pgen_lsp | This calculates the generalized Lomb-Scargle periodogram.
Uses the algorithm from Zechmeister and Kurster (2009).
Parameters
----------
times,mags,errs : np.array
The mag/flux time-series with associated measurement errors to run the
period-finding on.
magsarefluxes : bool
... | astrobase/periodbase/zgls.py | def pgen_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,
workchunksize=None,
glspfunc=_glsp_w... | def pgen_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,
workchunksize=None,
glspfunc=_glsp_w... | [
"This",
"calculates",
"the",
"generalized",
"Lomb",
"-",
"Scargle",
"periodogram",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/zgls.py#L462-L754 | [
"def",
"pgen_lsp",
"(",
"times",
",",
"mags",
",",
"errs",
",",
"magsarefluxes",
"=",
"False",
",",
"startp",
"=",
"None",
",",
"endp",
"=",
"None",
",",
"stepsize",
"=",
"1.0e-4",
",",
"autofreq",
"=",
"True",
",",
"nbestpeaks",
"=",
"5",
",",
"peri... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | specwindow_lsp | This calculates the spectral window function.
Wraps the `pgen_lsp` function above to use the specific worker for
calculating the window-function.
Parameters
----------
times,mags,errs : np.array
The mag/flux time-series with associated measurement errors to run the
period-finding ... | astrobase/periodbase/zgls.py | 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,
... | 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,
... | [
"This",
"calculates",
"the",
"spectral",
"window",
"function",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/zgls.py#L758-L902 | [
"def",
"specwindow_lsp",
"(",
"times",
",",
"mags",
",",
"errs",
",",
"magsarefluxes",
"=",
"False",
",",
"startp",
"=",
"None",
",",
"endp",
"=",
"None",
",",
"stepsize",
"=",
"1.0e-4",
",",
"autofreq",
"=",
"True",
",",
"nbestpeaks",
"=",
"5",
",",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | analytic_false_alarm_probability | This returns the analytic false alarm probabilities for periodogram
peak values.
The calculation follows that on page 3 of Zechmeister & Kurster (2009)::
FAP = 1 − [1 − Prob(z > z0)]**M
where::
M is the number of independent frequencies
Prob(z > z0) is the probability of peak wit... | astrobase/periodbase/zgls.py | def analytic_false_alarm_probability(lspinfo,
times,
conservative_nfreq_eff=True,
peakvals=None,
inplace=True):
'''This returns the analytic false alarm probabilities ... | def analytic_false_alarm_probability(lspinfo,
times,
conservative_nfreq_eff=True,
peakvals=None,
inplace=True):
'''This returns the analytic false alarm probabilities ... | [
"This",
"returns",
"the",
"analytic",
"false",
"alarm",
"probabilities",
"for",
"periodogram",
"peak",
"values",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/zgls.py#L948-L1026 | [
"def",
"analytic_false_alarm_probability",
"(",
"lspinfo",
",",
"times",
",",
"conservative_nfreq_eff",
"=",
"True",
",",
"peakvals",
"=",
"None",
",",
"inplace",
"=",
"True",
")",
":",
"frequencies",
"=",
"1.0",
"/",
"lspinfo",
"[",
"'periods'",
"]",
"M",
"... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | check_existing_apikey | 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::
~/.astrobase/lccs/apikey-https-data.hatsurveys.org
... | astrobase/services/lccs.py | 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... | 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... | [
"This",
"validates",
"if",
"an",
"API",
"key",
"for",
"the",
"specified",
"LCC",
"-",
"Server",
"is",
"available",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/lccs.py#L134-L212 | [
"def",
"check_existing_apikey",
"(",
"lcc_server",
")",
":",
"USERHOME",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~'",
")",
"APIKEYFILE",
"=",
"os",
".",
"path",
".",
"join",
"(",
"USERHOME",
",",
"'.astrobase'",
",",
"'lccs'",
",",
"'apikey-%s'",... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | get_new_apikey | 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
The base URL of the LCC-Server fr... | astrobase/services/lccs.py | 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
... | 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
... | [
"This",
"gets",
"a",
"new",
"API",
"key",
"from",
"the",
"specified",
"LCC",
"-",
"Server",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/lccs.py#L216-L288 | [
"def",
"get_new_apikey",
"(",
"lcc_server",
")",
":",
"USERHOME",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~'",
")",
"APIKEYFILE",
"=",
"os",
".",
"path",
".",
"join",
"(",
"USERHOME",
",",
"'.astrobase'",
",",
"'lccs'",
",",
"'apikey-%s'",
"%",... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | import_apikey | 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 objects, datasets, and collections
marked as private... | astrobase/services/lccs.py | 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 ... | 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 ... | [
"This",
"imports",
"an",
"API",
"key",
"from",
"text",
"and",
"writes",
"it",
"to",
"the",
"cache",
"dir",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/lccs.py#L292-L353 | [
"def",
"import_apikey",
"(",
"lcc_server",
",",
"apikey_text_json",
")",
":",
"USERHOME",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~'",
")",
"APIKEYFILE",
"=",
"os",
".",
"path",
".",
"join",
"(",
"USERHOME",
",",
"'.astrobase'",
",",
"'lccs'",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | submit_post_searchquery | 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 endpoint to hit. This is something like
`https://data.... | astrobase/services/lccs.py | 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... | 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... | [
"This",
"submits",
"a",
"POST",
"query",
"to",
"an",
"LCC",
"-",
"Server",
"search",
"API",
"endpoint",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/lccs.py#L361-L488 | [
"def",
"submit_post_searchquery",
"(",
"url",
",",
"data",
",",
"apikey",
")",
":",
"# first, we need to convert any columns and collections items to broken out",
"# params",
"postdata",
"=",
"{",
"}",
"for",
"key",
"in",
"data",
":",
"if",
"key",
"==",
"'columns'",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | retrieve_dataset_files | This retrieves a search result dataset's CSV and any LC zip files.
Takes the output from the `submit_post_searchquery` function above or a
pickle file generated from that function's output if the query timed out.
Parameters
----------
searchresult : str or tuple
If provided as a str, poin... | astrobase/services/lccs.py | def retrieve_dataset_files(searchresult,
getpickle=False,
outdir=None,
apikey=None):
'''This retrieves a search result dataset's CSV and any LC zip files.
Takes the output from the `submit_post_searchquery` function above or a
... | def retrieve_dataset_files(searchresult,
getpickle=False,
outdir=None,
apikey=None):
'''This retrieves a search result dataset's CSV and any LC zip files.
Takes the output from the `submit_post_searchquery` function above or a
... | [
"This",
"retrieves",
"a",
"search",
"result",
"dataset",
"s",
"CSV",
"and",
"any",
"LC",
"zip",
"files",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/lccs.py#L492-L715 | [
"def",
"retrieve_dataset_files",
"(",
"searchresult",
",",
"getpickle",
"=",
"False",
",",
"outdir",
"=",
"None",
",",
"apikey",
"=",
"None",
")",
":",
"# this handles the direct result case from submit_*_query functions",
"if",
"isinstance",
"(",
"searchresult",
",",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | cone_search | This runs a cone-search query.
Parameters
----------
lcc_server : str
This is the base URL of the LCC-Server to talk to. (e.g. for HAT, use:
https://data.hatsurveys.org)
center_ra,center_decl : float
These are the central coordinates of the search to conduct. These can be
... | astrobase/services/lccs.py | 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... | 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... | [
"This",
"runs",
"a",
"cone",
"-",
"search",
"query",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/lccs.py#L723-L980 | [
"def",
"cone_search",
"(",
"lcc_server",
",",
"center_ra",
",",
"center_decl",
",",
"radiusarcmin",
"=",
"5.0",
",",
"result_visibility",
"=",
"'unlisted'",
",",
"email_when_done",
"=",
"False",
",",
"collections",
"=",
"None",
",",
"columns",
"=",
"None",
","... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | xmatch_search | This runs a cross-match search query.
Parameters
----------
lcc_server : str
This is the base URL of the LCC-Server to talk to. (e.g. for HAT, use:
https://data.hatsurveys.org)
file_to_upload : str
This is the path to a text file containing objectid, RA, declination
r... | astrobase/services/lccs.py | 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... | 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... | [
"This",
"runs",
"a",
"cross",
"-",
"match",
"search",
"query",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/lccs.py#L1486-L1762 | [
"def",
"xmatch_search",
"(",
"lcc_server",
",",
"file_to_upload",
",",
"xmatch_dist_arcsec",
"=",
"3.0",
",",
"result_visibility",
"=",
"'unlisted'",
",",
"email_when_done",
"=",
"False",
",",
"collections",
"=",
"None",
",",
"columns",
"=",
"None",
",",
"filter... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | get_dataset | 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 want. The dataset JSON will
contain the keys 'npages', 'currpage', and 'rows_per_page' to help with
this. The 'r... | astrobase/services/lccs.py | 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... | 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... | [
"This",
"downloads",
"a",
"JSON",
"form",
"of",
"a",
"dataset",
"from",
"the",
"specified",
"lcc_server",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/lccs.py#L1770-L1853 | [
"def",
"get_dataset",
"(",
"lcc_server",
",",
"dataset_id",
",",
"strformat",
"=",
"False",
",",
"page",
"=",
"1",
")",
":",
"urlparams",
"=",
"{",
"'strformat'",
":",
"1",
"if",
"strformat",
"else",
"0",
",",
"'page'",
":",
"page",
",",
"'json'",
":",... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | object_info | 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).
If you have an LCC-Server API key present in `~/.astrobase/lc... | astrobase/services/lccs.py | 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).
... | 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).
... | [
"This",
"gets",
"information",
"on",
"a",
"single",
"object",
"from",
"the",
"LCC",
"-",
"Server",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/lccs.py#L1857-L1985 | [
"def",
"object_info",
"(",
"lcc_server",
",",
"objectid",
",",
"db_collection_id",
")",
":",
"urlparams",
"=",
"{",
"'objectid'",
":",
"objectid",
",",
"'collection'",
":",
"db_collection_id",
"}",
"urlqs",
"=",
"urlencode",
"(",
"urlparams",
")",
"url",
"=",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | list_recent_datasets | 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, even if they are not visible to the public.
Paramet... | astrobase/services/lccs.py | 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,... | 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,... | [
"This",
"lists",
"recent",
"publicly",
"visible",
"datasets",
"available",
"on",
"the",
"LCC",
"-",
"Server",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/lccs.py#L1989-L2054 | [
"def",
"list_recent_datasets",
"(",
"lcc_server",
",",
"nrecent",
"=",
"25",
")",
":",
"urlparams",
"=",
"{",
"'nsets'",
":",
"nrecent",
"}",
"urlqs",
"=",
"urlencode",
"(",
"urlparams",
")",
"url",
"=",
"'%s/api/datasets?%s'",
"%",
"(",
"lcc_server",
",",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | list_lc_collections | 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, even if they are not visible to the
publi... | astrobase/services/lccs.py | 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... | 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... | [
"This",
"lists",
"all",
"light",
"curve",
"collections",
"made",
"available",
"on",
"the",
"LCC",
"-",
"Server",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/lccs.py#L2058-L2120 | [
"def",
"list_lc_collections",
"(",
"lcc_server",
")",
":",
"url",
"=",
"'%s/api/collections'",
"%",
"lcc_server",
"try",
":",
"LOGINFO",
"(",
"'getting list of recent publicly visible '",
"'and owned LC collections from %s'",
"%",
"(",
"lcc_server",
",",
")",
")",
"# ch... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | stetson_jindex | 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,ferrs : np.array
The input mag/flux time-series with all non-fin... | astrobase/varclass/varfeatures.py | 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... | 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... | [
"This",
"calculates",
"the",
"Stetson",
"index",
"for",
"the",
"magseries",
"based",
"on",
"consecutive",
"pairs",
"of",
"observations",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varclass/varfeatures.py#L68-L131 | [
"def",
"stetson_jindex",
"(",
"ftimes",
",",
"fmags",
",",
"ferrs",
",",
"weightbytimediff",
"=",
"False",
")",
":",
"ndet",
"=",
"len",
"(",
"fmags",
")",
"if",
"ndet",
">",
"9",
":",
"# get the median and ndet",
"medmag",
"=",
"npmedian",
"(",
"fmags",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | stetson_kindex | This calculates the Stetson K index (a robust measure of the kurtosis).
Parameters
----------
fmags,ferrs : np.array
The input mag/flux time-series to process. Must have no non-finite
elems.
Returns
-------
float
The Stetson K variability index. | astrobase/varclass/varfeatures.py | def stetson_kindex(fmags, ferrs):
'''This calculates the Stetson K index (a robust measure of the kurtosis).
Parameters
----------
fmags,ferrs : np.array
The input mag/flux time-series to process. Must have no non-finite
elems.
Returns
-------
float
The Stetson K ... | def stetson_kindex(fmags, ferrs):
'''This calculates the Stetson K index (a robust measure of the kurtosis).
Parameters
----------
fmags,ferrs : np.array
The input mag/flux time-series to process. Must have no non-finite
elems.
Returns
-------
float
The Stetson K ... | [
"This",
"calculates",
"the",
"Stetson",
"K",
"index",
"(",
"a",
"robust",
"measure",
"of",
"the",
"kurtosis",
")",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varclass/varfeatures.py#L135-L179 | [
"def",
"stetson_kindex",
"(",
"fmags",
",",
"ferrs",
")",
":",
"# use a fill in value for the errors if they're none",
"if",
"ferrs",
"is",
"None",
":",
"ferrs",
"=",
"npfull_like",
"(",
"fmags",
",",
"0.005",
")",
"ndet",
"=",
"len",
"(",
"fmags",
")",
"if",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | lightcurve_moments | 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 removed.
Returns
-------
dict
A dict... | astrobase/varclass/varfeatures.py | 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... | 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... | [
"This",
"calculates",
"the",
"weighted",
"mean",
"stdev",
"median",
"MAD",
"percentiles",
"skew",
"kurtosis",
"fraction",
"of",
"LC",
"beyond",
"1",
"-",
"stdev",
"and",
"IQR",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varclass/varfeatures.py#L183-L244 | [
"def",
"lightcurve_moments",
"(",
"ftimes",
",",
"fmags",
",",
"ferrs",
")",
":",
"ndet",
"=",
"len",
"(",
"fmags",
")",
"if",
"ndet",
">",
"9",
":",
"# now calculate the various things we need",
"series_median",
"=",
"npmedian",
"(",
"fmags",
")",
"series_wme... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | lightcurve_flux_measures | 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
If the `fmags` array actually contains fluxes, will not convert `mags`
t... | astrobase/varclass/varfeatures.py | 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
... | 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
... | [
"This",
"calculates",
"percentiles",
"and",
"percentile",
"ratios",
"of",
"the",
"flux",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varclass/varfeatures.py#L248-L343 | [
"def",
"lightcurve_flux_measures",
"(",
"ftimes",
",",
"fmags",
",",
"ferrs",
",",
"magsarefluxes",
"=",
"False",
")",
":",
"ndet",
"=",
"len",
"(",
"fmags",
")",
"if",
"ndet",
">",
"9",
":",
"# get the fluxes",
"if",
"magsarefluxes",
":",
"series_fluxes",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | lightcurve_ptp_measures | This calculates various point-to-point measures (`eta` in Kim+ 2014).
Parameters
----------
ftimes,fmags,ferrs : np.array
The input mag/flux time-series with all non-finite elements removed.
Returns
-------
dict
A dict with values of the point-to-point measures, including the... | astrobase/varclass/varfeatures.py | def lightcurve_ptp_measures(ftimes, fmags, ferrs):
'''This calculates various point-to-point measures (`eta` in Kim+ 2014).
Parameters
----------
ftimes,fmags,ferrs : np.array
The input mag/flux time-series with all non-finite elements removed.
Returns
-------
dict
A dict... | def lightcurve_ptp_measures(ftimes, fmags, ferrs):
'''This calculates various point-to-point measures (`eta` in Kim+ 2014).
Parameters
----------
ftimes,fmags,ferrs : np.array
The input mag/flux time-series with all non-finite elements removed.
Returns
-------
dict
A dict... | [
"This",
"calculates",
"various",
"point",
"-",
"to",
"-",
"point",
"measures",
"(",
"eta",
"in",
"Kim",
"+",
"2014",
")",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varclass/varfeatures.py#L347-L426 | [
"def",
"lightcurve_ptp_measures",
"(",
"ftimes",
",",
"fmags",
",",
"ferrs",
")",
":",
"ndet",
"=",
"len",
"(",
"fmags",
")",
"if",
"ndet",
">",
"9",
":",
"timediffs",
"=",
"npdiff",
"(",
"ftimes",
")",
"# get rid of stuff with time diff = 0.0",
"nzind",
"="... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | nonperiodic_lightcurve_features | This calculates the following nonperiodic features of the light curve,
listed in Richards, et al. 2011):
- amplitude
- beyond1std
- flux_percentile_ratio_mid20
- flux_percentile_ratio_mid35
- flux_percentile_ratio_mid50
- flux_percentile_ratio_mid65
- flux_percentile_ratio_mid80
- l... | astrobase/varclass/varfeatures.py | def nonperiodic_lightcurve_features(times, mags, errs, magsarefluxes=False):
'''This calculates the following nonperiodic features of the light curve,
listed in Richards, et al. 2011):
- amplitude
- beyond1std
- flux_percentile_ratio_mid20
- flux_percentile_ratio_mid35
- flux_percentile_rat... | def nonperiodic_lightcurve_features(times, mags, errs, magsarefluxes=False):
'''This calculates the following nonperiodic features of the light curve,
listed in Richards, et al. 2011):
- amplitude
- beyond1std
- flux_percentile_ratio_mid20
- flux_percentile_ratio_mid35
- flux_percentile_rat... | [
"This",
"calculates",
"the",
"following",
"nonperiodic",
"features",
"of",
"the",
"light",
"curve",
"listed",
"in",
"Richards",
"et",
"al",
".",
"2011",
")",
":"
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varclass/varfeatures.py#L430-L536 | [
"def",
"nonperiodic_lightcurve_features",
"(",
"times",
",",
"mags",
",",
"errs",
",",
"magsarefluxes",
"=",
"False",
")",
":",
"# remove nans first",
"finiteind",
"=",
"npisfinite",
"(",
"times",
")",
"&",
"npisfinite",
"(",
"mags",
")",
"&",
"npisfinite",
"(... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | gilliland_cdpp | This calculates the CDPP of a timeseries using the method in the paper:
Gilliland, R. L., Chaplin, W. J., Dunham, E. W., et al. 2011, ApJS, 197, 6
(http://adsabs.harvard.edu/abs/2011ApJS..197....6G)
The steps are:
- pass the time-series through a Savitsky-Golay filter.
- we use `scipy.signal.s... | astrobase/varclass/varfeatures.py | def gilliland_cdpp(times, mags, errs,
windowlength=97,
polyorder=2,
binsize=23400, # in seconds: 6.5 hours for classic CDPP
sigclip=5.0,
magsarefluxes=False,
**kwargs):
'''This calculates the CDPP of a... | def gilliland_cdpp(times, mags, errs,
windowlength=97,
polyorder=2,
binsize=23400, # in seconds: 6.5 hours for classic CDPP
sigclip=5.0,
magsarefluxes=False,
**kwargs):
'''This calculates the CDPP of a... | [
"This",
"calculates",
"the",
"CDPP",
"of",
"a",
"timeseries",
"using",
"the",
"method",
"in",
"the",
"paper",
":"
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varclass/varfeatures.py#L544-L662 | [
"def",
"gilliland_cdpp",
"(",
"times",
",",
"mags",
",",
"errs",
",",
"windowlength",
"=",
"97",
",",
"polyorder",
"=",
"2",
",",
"binsize",
"=",
"23400",
",",
"# in seconds: 6.5 hours for classic CDPP",
"sigclip",
"=",
"5.0",
",",
"magsarefluxes",
"=",
"False... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | all_nonperiodic_features | 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
smoothing takes a while for dense light curves.
Parameters
----------
times,mags,errs : np.array
The input mag/flux time-series to calculate CDPP for.
... | astrobase/varclass/varfeatures.py | 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... | 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... | [
"This",
"rolls",
"up",
"the",
"feature",
"functions",
"above",
"and",
"returns",
"a",
"single",
"dict",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varclass/varfeatures.py#L671-L720 | [
"def",
"all_nonperiodic_features",
"(",
"times",
",",
"mags",
",",
"errs",
",",
"magsarefluxes",
"=",
"False",
",",
"stetson_weightbytimediff",
"=",
"True",
")",
":",
"# remove nans first",
"finiteind",
"=",
"npisfinite",
"(",
"times",
")",
"&",
"npisfinite",
"(... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _bls_runner | This runs the pyeebls.eebls function using the given inputs.
Parameters
----------
times,mags : np.array
The input magnitude time-series to search for transits.
nfreq : int
The number of frequencies to use when searching for transits.
freqmin : float
The minimum frequency... | astrobase/periodbase/kbls.py | 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... | 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... | [
"This",
"runs",
"the",
"pyeebls",
".",
"eebls",
"function",
"using",
"the",
"given",
"inputs",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/kbls.py#L76-L143 | [
"def",
"_bls_runner",
"(",
"times",
",",
"mags",
",",
"nfreq",
",",
"freqmin",
",",
"stepsize",
",",
"nbins",
",",
"minduration",
",",
"maxduration",
")",
":",
"workarr_u",
"=",
"npones",
"(",
"times",
".",
"size",
")",
"workarr_v",
"=",
"npones",
"(",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _parallel_bls_worker | 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] = stepsize
task[5] = nbins
... | astrobase/periodbase/kbls.py | 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... | 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... | [
"This",
"wraps",
"the",
"BLS",
"function",
"for",
"the",
"parallel",
"driver",
"below",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/kbls.py#L147-L200 | [
"def",
"_parallel_bls_worker",
"(",
"task",
")",
":",
"try",
":",
"return",
"_bls_runner",
"(",
"*",
"task",
")",
"except",
"Exception",
"as",
"e",
":",
"LOGEXCEPTION",
"(",
"'BLS failed for task %s'",
"%",
"repr",
"(",
"task",
"[",
"2",
":",
"]",
")",
"... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | bls_serial_pfind | Runs the Box Least Squares Fitting Search for transit-shaped signals.
Based on eebls.f from Kovacs et al. 2002 and python-bls from Foreman-Mackey
et al. 2015. This is the serial version (which is good enough in most cases
because BLS in Fortran is fairly fast). If nfreq > 5e5, this will take a
while.
... | astrobase/periodbase/kbls.py | def bls_serial_pfind(
times, mags, errs,
magsarefluxes=False,
startp=0.1, # search from 0.1 d to...
endp=100.0, # ... 100.0 d -- don't search full timebase
stepsize=5.0e-4,
mintransitduration=0.01, # minimum transit length in phase
maxtransitduration=0.4, # m... | def bls_serial_pfind(
times, mags, errs,
magsarefluxes=False,
startp=0.1, # search from 0.1 d to...
endp=100.0, # ... 100.0 d -- don't search full timebase
stepsize=5.0e-4,
mintransitduration=0.01, # minimum transit length in phase
maxtransitduration=0.4, # m... | [
"Runs",
"the",
"Box",
"Least",
"Squares",
"Fitting",
"Search",
"for",
"transit",
"-",
"shaped",
"signals",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/kbls.py#L205-L622 | [
"def",
"bls_serial_pfind",
"(",
"times",
",",
"mags",
",",
"errs",
",",
"magsarefluxes",
"=",
"False",
",",
"startp",
"=",
"0.1",
",",
"# search from 0.1 d to...",
"endp",
"=",
"100.0",
",",
"# ... 100.0 d -- don't search full timebase",
"stepsize",
"=",
"5.0e-4",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | bls_parallel_pfind | Runs the Box Least Squares Fitting Search for transit-shaped signals.
Based on eebls.f from Kovacs et al. 2002 and python-bls from Foreman-Mackey
et al. 2015. Breaks up the full frequency space into chunks and passes them
to parallel BLS workers.
NOTE: the combined BLS spectrum produced by this functi... | astrobase/periodbase/kbls.py | 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... | 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... | [
"Runs",
"the",
"Box",
"Least",
"Squares",
"Fitting",
"Search",
"for",
"transit",
"-",
"shaped",
"signals",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/kbls.py#L626-L1049 | [
"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",
"=",... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _get_bls_stats | Actually calculates the stats. | astrobase/periodbase/kbls.py | def _get_bls_stats(stimes,
smags,
serrs,
thistransdepth,
thistransduration,
ingressdurationfraction,
nphasebins,
thistransingressbin,
thistransegressbin,
... | def _get_bls_stats(stimes,
smags,
serrs,
thistransdepth,
thistransduration,
ingressdurationfraction,
nphasebins,
thistransingressbin,
thistransegressbin,
... | [
"Actually",
"calculates",
"the",
"stats",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/kbls.py#L1053-L1292 | [
"def",
"_get_bls_stats",
"(",
"stimes",
",",
"smags",
",",
"serrs",
",",
"thistransdepth",
",",
"thistransduration",
",",
"ingressdurationfraction",
",",
"nphasebins",
",",
"thistransingressbin",
",",
"thistransegressbin",
",",
"thisbestperiod",
",",
"thisnphasebins",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | bls_stats_singleperiod | This calculates the SNR, depth, duration, a refit period, and time of
center-transit for a single period.
The equation used for SNR is::
SNR = (transit model depth / RMS of LC with transit model subtracted)
* sqrt(number of points in transit)
NOTE: you should set the kwargs `sigclip... | astrobase/periodbase/kbls.py | def bls_stats_singleperiod(times, mags, errs, period,
magsarefluxes=False,
sigclip=10.0,
perioddeltapercent=10,
nphasebins=200,
mintransitduration=0.01,
maxtr... | def bls_stats_singleperiod(times, mags, errs, period,
magsarefluxes=False,
sigclip=10.0,
perioddeltapercent=10,
nphasebins=200,
mintransitduration=0.01,
maxtr... | [
"This",
"calculates",
"the",
"SNR",
"depth",
"duration",
"a",
"refit",
"period",
"and",
"time",
"of",
"center",
"-",
"transit",
"for",
"a",
"single",
"period",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/kbls.py#L1296-L1464 | [
"def",
"bls_stats_singleperiod",
"(",
"times",
",",
"mags",
",",
"errs",
",",
"period",
",",
"magsarefluxes",
"=",
"False",
",",
"sigclip",
"=",
"10.0",
",",
"perioddeltapercent",
"=",
"10",
",",
"nphasebins",
"=",
"200",
",",
"mintransitduration",
"=",
"0.0... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | bls_snr | Calculates the signal to noise ratio for each best peak in the BLS
periodogram, along with transit depth, duration, and refit period and epoch.
The following equation is used for SNR::
SNR = (transit model depth / RMS of LC with transit model subtracted)
* sqrt(number of points in transi... | astrobase/periodbase/kbls.py | def bls_snr(blsdict,
times,
mags,
errs,
assumeserialbls=False,
magsarefluxes=False,
sigclip=10.0,
npeaks=None,
perioddeltapercent=10,
ingressdurationfraction=0.1,
verbose=True):
'''Calculates the ... | def bls_snr(blsdict,
times,
mags,
errs,
assumeserialbls=False,
magsarefluxes=False,
sigclip=10.0,
npeaks=None,
perioddeltapercent=10,
ingressdurationfraction=0.1,
verbose=True):
'''Calculates the ... | [
"Calculates",
"the",
"signal",
"to",
"noise",
"ratio",
"for",
"each",
"best",
"peak",
"in",
"the",
"BLS",
"periodogram",
"along",
"with",
"transit",
"depth",
"duration",
"and",
"refit",
"period",
"and",
"epoch",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/kbls.py#L1468-L1702 | [
"def",
"bls_snr",
"(",
"blsdict",
",",
"times",
",",
"mags",
",",
"errs",
",",
"assumeserialbls",
"=",
"False",
",",
"magsarefluxes",
"=",
"False",
",",
"sigclip",
"=",
"10.0",
",",
"npeaks",
"=",
"None",
",",
"perioddeltapercent",
"=",
"10",
",",
"ingre... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | massradius | 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
This should be one of: 0.02, 0.045, 0.1, 1.0, 9.5 [in AU]
coremass : int
This should be one of: 0, 10, 25, ... | astrobase/services/fortney2k7.py | 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
... | 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
... | [
"This",
"function",
"gets",
"the",
"Fortney",
"mass",
"-",
"radius",
"relation",
"for",
"planets",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/fortney2k7.py#L521-L578 | [
"def",
"massradius",
"(",
"age",
",",
"planetdist",
",",
"coremass",
",",
"mass",
"=",
"'massjupiter'",
",",
"radius",
"=",
"'radiusjupiter'",
")",
":",
"MR",
"=",
"{",
"0.3",
":",
"MASSESRADII_0_3GYR",
",",
"1.0",
":",
"MASSESRADII_1_0GYR",
",",
"4.5",
":... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _collect_tfa_stats | This is a parallel worker to gather LC stats.
task[0] = lcfile
task[1] = lcformat
task[2] = lcformatdir
task[3] = timecols
task[4] = magcols
task[5] = errcols
task[6] = custom_bandpasses | astrobase/lcproc/tfa.py | def _collect_tfa_stats(task):
'''
This is a parallel worker to gather LC stats.
task[0] = lcfile
task[1] = lcformat
task[2] = lcformatdir
task[3] = timecols
task[4] = magcols
task[5] = errcols
task[6] = custom_bandpasses
'''
try:
(lcfile, lcformat, lcformatdir,
... | def _collect_tfa_stats(task):
'''
This is a parallel worker to gather LC stats.
task[0] = lcfile
task[1] = lcformat
task[2] = lcformatdir
task[3] = timecols
task[4] = magcols
task[5] = errcols
task[6] = custom_bandpasses
'''
try:
(lcfile, lcformat, lcformatdir,
... | [
"This",
"is",
"a",
"parallel",
"worker",
"to",
"gather",
"LC",
"stats",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/tfa.py#L102-L259 | [
"def",
"_collect_tfa_stats",
"(",
"task",
")",
":",
"try",
":",
"(",
"lcfile",
",",
"lcformat",
",",
"lcformatdir",
",",
"timecols",
",",
"magcols",
",",
"errcols",
",",
"custom_bandpasses",
")",
"=",
"task",
"try",
":",
"formatinfo",
"=",
"get_lcformat",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _reform_templatelc_for_tfa | 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] = sigclip | astrobase/lcproc/tfa.py | 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... | 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... | [
"This",
"is",
"a",
"parallel",
"worker",
"that",
"reforms",
"light",
"curves",
"for",
"TFA",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/tfa.py#L263-L378 | [
"def",
"_reform_templatelc_for_tfa",
"(",
"task",
")",
":",
"try",
":",
"(",
"lcfile",
",",
"lcformat",
",",
"lcformatdir",
",",
"tcol",
",",
"mcol",
",",
"ecol",
",",
"timebase",
",",
"interpolate_type",
",",
"sigclip",
")",
"=",
"task",
"try",
":",
"fo... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | tfa_templates_lclist | This selects template objects for TFA.
Selection criteria for TFA template ensemble objects:
- not variable: use a poly fit to the mag-MAD relation and eta-normal
variability index to get nonvar objects
- not more than 10% of the total number of objects in the field or
`max_tfa_templates` at ... | astrobase/lcproc/tfa.py | def tfa_templates_lclist(
lclist,
lcinfo_pkl=None,
outfile=None,
target_template_frac=0.1,
max_target_frac_obs=0.25,
min_template_number=10,
max_template_number=1000,
max_rms=0.15,
max_mult_above_magmad=1.5,
max_mult_above_mageta=1.5,
... | def tfa_templates_lclist(
lclist,
lcinfo_pkl=None,
outfile=None,
target_template_frac=0.1,
max_target_frac_obs=0.25,
min_template_number=10,
max_template_number=1000,
max_rms=0.15,
max_mult_above_magmad=1.5,
max_mult_above_mageta=1.5,
... | [
"This",
"selects",
"template",
"objects",
"for",
"TFA",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/tfa.py#L382-L1090 | [
"def",
"tfa_templates_lclist",
"(",
"lclist",
",",
"lcinfo_pkl",
"=",
"None",
",",
"outfile",
"=",
"None",
",",
"target_template_frac",
"=",
"0.1",
",",
"max_target_frac_obs",
"=",
"0.25",
",",
"min_template_number",
"=",
"10",
",",
"max_template_number",
"=",
"... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | apply_tfa_magseries | This applies the TFA correction to an LC given TFA template information.
Parameters
----------
lcfile : str
This is the light curve file to apply the TFA correction to.
timecol,magcol,errcol : str
These are the column keys in the lcdict for the LC file to apply the TFA
correct... | astrobase/lcproc/tfa.py | def apply_tfa_magseries(lcfile,
timecol,
magcol,
errcol,
templateinfo,
mintemplatedist_arcmin=10.0,
lcformat='hat-sql',
lcformatdir=None,
... | def apply_tfa_magseries(lcfile,
timecol,
magcol,
errcol,
templateinfo,
mintemplatedist_arcmin=10.0,
lcformat='hat-sql',
lcformatdir=None,
... | [
"This",
"applies",
"the",
"TFA",
"correction",
"to",
"an",
"LC",
"given",
"TFA",
"template",
"information",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/tfa.py#L1094-L1289 | [
"def",
"apply_tfa_magseries",
"(",
"lcfile",
",",
"timecol",
",",
"magcol",
",",
"errcol",
",",
"templateinfo",
",",
"mintemplatedist_arcmin",
"=",
"10.0",
",",
"lcformat",
"=",
"'hat-sql'",
",",
"lcformatdir",
"=",
"None",
",",
"interp",
"=",
"'nearest'",
","... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _parallel_tfa_worker | This is a parallel worker for the function below.
task[0] = lcfile
task[1] = timecol
task[2] = magcol
task[3] = errcol
task[4] = templateinfo
task[5] = lcformat
task[6] = lcformatdir
task[6] = interp
task[7] = sigclip | astrobase/lcproc/tfa.py | def _parallel_tfa_worker(task):
'''
This is a parallel worker for the function below.
task[0] = lcfile
task[1] = timecol
task[2] = magcol
task[3] = errcol
task[4] = templateinfo
task[5] = lcformat
task[6] = lcformatdir
task[6] = interp
task[7] = sigclip
'''
(lcfile... | def _parallel_tfa_worker(task):
'''
This is a parallel worker for the function below.
task[0] = lcfile
task[1] = timecol
task[2] = magcol
task[3] = errcol
task[4] = templateinfo
task[5] = lcformat
task[6] = lcformatdir
task[6] = interp
task[7] = sigclip
'''
(lcfile... | [
"This",
"is",
"a",
"parallel",
"worker",
"for",
"the",
"function",
"below",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/tfa.py#L1293-L1331 | [
"def",
"_parallel_tfa_worker",
"(",
"task",
")",
":",
"(",
"lcfile",
",",
"timecol",
",",
"magcol",
",",
"errcol",
",",
"templateinfo",
",",
"lcformat",
",",
"lcformatdir",
",",
"interp",
",",
"sigclip",
",",
"mintemplatedist_arcmin",
")",
"=",
"task",
"try"... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | parallel_tfa_lclist | This applies TFA in parallel to all LCs in the given list of file names.
Parameters
----------
lclist : str
This is a list of light curve files to apply TFA correction to.
templateinfo : dict or str
This is either the dict produced by `tfa_templates_lclist` or the pickle
produ... | astrobase/lcproc/tfa.py | def parallel_tfa_lclist(lclist,
templateinfo,
timecols=None,
magcols=None,
errcols=None,
lcformat='hat-sql',
lcformatdir=None,
interp='nearest',
... | def parallel_tfa_lclist(lclist,
templateinfo,
timecols=None,
magcols=None,
errcols=None,
lcformat='hat-sql',
lcformatdir=None,
interp='nearest',
... | [
"This",
"applies",
"TFA",
"in",
"parallel",
"to",
"all",
"LCs",
"in",
"the",
"given",
"list",
"of",
"file",
"names",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/tfa.py#L1335-L1456 | [
"def",
"parallel_tfa_lclist",
"(",
"lclist",
",",
"templateinfo",
",",
"timecols",
"=",
"None",
",",
"magcols",
"=",
"None",
",",
"errcols",
"=",
"None",
",",
"lcformat",
"=",
"'hat-sql'",
",",
"lcformatdir",
"=",
"None",
",",
"interp",
"=",
"'nearest'",
"... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | parallel_tfa_lcdir | This applies TFA in parallel to all LCs in a directory.
Parameters
----------
lcdir : str
This is the directory containing the light curve files to process..
templateinfo : dict or str
This is either the dict produced by `tfa_templates_lclist` or the pickle
produced by the sam... | astrobase/lcproc/tfa.py | def parallel_tfa_lcdir(lcdir,
templateinfo,
lcfileglob=None,
timecols=None,
magcols=None,
errcols=None,
lcformat='hat-sql',
lcformatdir=None,
... | def parallel_tfa_lcdir(lcdir,
templateinfo,
lcfileglob=None,
timecols=None,
magcols=None,
errcols=None,
lcformat='hat-sql',
lcformatdir=None,
... | [
"This",
"applies",
"TFA",
"in",
"parallel",
"to",
"all",
"LCs",
"in",
"a",
"directory",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/tfa.py#L1460-L1579 | [
"def",
"parallel_tfa_lcdir",
"(",
"lcdir",
",",
"templateinfo",
",",
"lcfileglob",
"=",
"None",
",",
"timecols",
"=",
"None",
",",
"magcols",
"=",
"None",
",",
"errcols",
"=",
"None",
",",
"lcformat",
"=",
"'hat-sql'",
",",
"lcformatdir",
"=",
"None",
",",... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | update_checkplot_objectinfo | This updates a checkplot objectinfo dict.
Useful in cases where a previous round of GAIA/finderchart/external catalog
acquisition failed. This will preserve the following keys in the checkplot
if they exist::
comments
varinfo
objectinfo.objecttags
Parameters
----------
... | astrobase/checkplot/pkl_postproc.py | def update_checkplot_objectinfo(cpf,
fast_mode=False,
findercmap='gray_r',
finderconvolve=None,
deredden_object=True,
custom_bandpasses=None,
... | def update_checkplot_objectinfo(cpf,
fast_mode=False,
findercmap='gray_r',
finderconvolve=None,
deredden_object=True,
custom_bandpasses=None,
... | [
"This",
"updates",
"a",
"checkplot",
"objectinfo",
"dict",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/checkplot/pkl_postproc.py#L62-L426 | [
"def",
"update_checkplot_objectinfo",
"(",
"cpf",
",",
"fast_mode",
"=",
"False",
",",
"findercmap",
"=",
"'gray_r'",
",",
"finderconvolve",
"=",
"None",
",",
"deredden_object",
"=",
"True",
",",
"custom_bandpasses",
"=",
"None",
",",
"gaia_submit_timeout",
"=",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _read_pklc | 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. | astrobase/lcproc/__init__.py | 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... | 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... | [
"This",
"just",
"reads",
"a",
"light",
"curve",
"pickle",
"file",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/__init__.py#L123-L159 | [
"def",
"_read_pklc",
"(",
"lcfile",
")",
":",
"if",
"lcfile",
".",
"endswith",
"(",
"'.gz'",
")",
":",
"try",
":",
"with",
"gzip",
".",
"open",
"(",
"lcfile",
",",
"'rb'",
")",
"as",
"infd",
":",
"lcdict",
"=",
"pickle",
".",
"load",
"(",
"infd",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | _check_extmodule | 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, e.g. 'astrobase.lcproc.catalogs' or
- ... | astrobase/lcproc/__init__.py | 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... | 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... | [
"This",
"imports",
"the",
"module",
"specified",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/__init__.py#L167-L222 | [
"def",
"_check_extmodule",
"(",
"module",
",",
"formatkey",
")",
":",
"try",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"module",
")",
":",
"sys",
".",
"path",
".",
"append",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"module",
")",
")",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | register_lcformat | This adds a new LC format to the astrobase LC format registry.
Allows handling of custom format light curves for astrobase lcproc
drivers. Once the format is successfully registered, light curves should
work transparently with all of the functions in this module, by simply
calling them with the `format... | astrobase/lcproc/__init__.py | def register_lcformat(formatkey,
fileglob,
timecols,
magcols,
errcols,
readerfunc_module,
readerfunc,
readerfunc_kwargs=None,
normfunc_module=No... | def register_lcformat(formatkey,
fileglob,
timecols,
magcols,
errcols,
readerfunc_module,
readerfunc,
readerfunc_kwargs=None,
normfunc_module=No... | [
"This",
"adds",
"a",
"new",
"LC",
"format",
"to",
"the",
"astrobase",
"LC",
"format",
"registry",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/__init__.py#L226-L448 | [
"def",
"register_lcformat",
"(",
"formatkey",
",",
"fileglob",
",",
"timecols",
",",
"magcols",
",",
"errcols",
",",
"readerfunc_module",
",",
"readerfunc",
",",
"readerfunc_kwargs",
"=",
"None",
",",
"normfunc_module",
"=",
"None",
",",
"normfunc",
"=",
"None",... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | get_lcformat | This loads an LC format description from a previously-saved JSON file.
Parameters
----------
formatkey : str
The key used to refer to the LC format. This is part of the JSON file's
name, e.g. the format key 'hat-csv' maps to the format JSON file:
'<astrobase install path>/data/lcfo... | astrobase/lcproc/__init__.py | def get_lcformat(formatkey, use_lcformat_dir=None):
'''This loads an LC format description from a previously-saved JSON file.
Parameters
----------
formatkey : str
The key used to refer to the LC format. This is part of the JSON file's
name, e.g. the format key 'hat-csv' maps to the fo... | def get_lcformat(formatkey, use_lcformat_dir=None):
'''This loads an LC format description from a previously-saved JSON file.
Parameters
----------
formatkey : str
The key used to refer to the LC format. This is part of the JSON file's
name, e.g. the format key 'hat-csv' maps to the fo... | [
"This",
"loads",
"an",
"LC",
"format",
"description",
"from",
"a",
"previously",
"-",
"saved",
"JSON",
"file",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcproc/__init__.py#L452-L640 | [
"def",
"get_lcformat",
"(",
"formatkey",
",",
"use_lcformat_dir",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"use_lcformat_dir",
",",
"str",
")",
":",
"# look for the lcformat JSON",
"lcformat_jsonpath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"use_lcform... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | ec2_ssh | 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
The path to the keypair PEM file generated by AWS to allow SSH
connections.
username : str
... | astrobase/awsutils.py | 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... | 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... | [
"This",
"opens",
"an",
"SSH",
"connection",
"to",
"the",
"EC2",
"instance",
"at",
"ip_address",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L72-L132 | [
"def",
"ec2_ssh",
"(",
"ip_address",
",",
"keypem_file",
",",
"username",
"=",
"'ec2-user'",
",",
"raiseonfail",
"=",
"False",
")",
":",
"c",
"=",
"paramiko",
".",
"client",
".",
"SSHClient",
"(",
")",
"c",
".",
"load_system_host_keys",
"(",
")",
"c",
".... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | s3_get_file | This gets a file from an S3 bucket.
Parameters
----------
bucket : str
The AWS S3 bucket name.
filename : str
The full filename of the file to get from the bucket
local_file : str
Path to where the downloaded file will be stored.
altexts : None or list of str
... | astrobase/awsutils.py | 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
... | 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
... | [
"This",
"gets",
"a",
"file",
"from",
"an",
"S3",
"bucket",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L140-L220 | [
"def",
"s3_get_file",
"(",
"bucket",
",",
"filename",
",",
"local_file",
",",
"altexts",
"=",
"None",
",",
"client",
"=",
"None",
",",
"raiseonfail",
"=",
"False",
")",
":",
"if",
"not",
"client",
":",
"client",
"=",
"boto3",
".",
"client",
"(",
"'s3'"... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | s3_get_url | This gets a file from an S3 bucket based on its s3:// URL.
Parameters
----------
url : str
S3 URL to download. This should begin with 's3://'.
altexts : None or list of str
If not None, this is a list of alternate extensions to try for the file
other than the one provided in `... | astrobase/awsutils.py | def s3_get_url(url,
altexts=None,
client=None,
raiseonfail=False):
"""This gets a file from an S3 bucket based on its s3:// URL.
Parameters
----------
url : str
S3 URL to download. This should begin with 's3://'.
altexts : None or list of str
... | def s3_get_url(url,
altexts=None,
client=None,
raiseonfail=False):
"""This gets a file from an S3 bucket based on its s3:// URL.
Parameters
----------
url : str
S3 URL to download. This should begin with 's3://'.
altexts : None or list of str
... | [
"This",
"gets",
"a",
"file",
"from",
"an",
"S3",
"bucket",
"based",
"on",
"its",
"s3",
":",
"//",
"URL",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L224-L271 | [
"def",
"s3_get_url",
"(",
"url",
",",
"altexts",
"=",
"None",
",",
"client",
"=",
"None",
",",
"raiseonfail",
"=",
"False",
")",
":",
"bucket_item",
"=",
"url",
".",
"replace",
"(",
"'s3://'",
",",
"''",
")",
"bucket_item",
"=",
"bucket_item",
".",
"sp... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | s3_put_file | 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, this function will instantiate a new `boto3.Client` object to
use in it... | astrobase/awsutils.py | 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... | 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... | [
"This",
"uploads",
"a",
"file",
"to",
"S3",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L275-L318 | [
"def",
"s3_put_file",
"(",
"local_file",
",",
"bucket",
",",
"client",
"=",
"None",
",",
"raiseonfail",
"=",
"False",
")",
":",
"if",
"not",
"client",
":",
"client",
"=",
"boto3",
".",
"client",
"(",
"'s3'",
")",
"try",
":",
"client",
".",
"upload_file... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | s3_delete_file | 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.Client or None
If None, this function will instantiate a new `boto3.C... | astrobase/awsutils.py | 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.... | 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.... | [
"This",
"deletes",
"a",
"file",
"from",
"S3",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L322-L369 | [
"def",
"s3_delete_file",
"(",
"bucket",
",",
"filename",
",",
"client",
"=",
"None",
",",
"raiseonfail",
"=",
"False",
")",
":",
"if",
"not",
"client",
":",
"client",
"=",
"boto3",
".",
"client",
"(",
"'s3'",
")",
"try",
":",
"resp",
"=",
"client",
"... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | sqs_create_queue | 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 docs for details. If None, no custom attributes will be
attached to ... | astrobase/awsutils.py | 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... | 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... | [
"This",
"creates",
"an",
"SQS",
"queue",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L377-L429 | [
"def",
"sqs_create_queue",
"(",
"queue_name",
",",
"options",
"=",
"None",
",",
"client",
"=",
"None",
")",
":",
"if",
"not",
"client",
":",
"client",
"=",
"boto3",
".",
"client",
"(",
"'sqs'",
")",
"try",
":",
"if",
"isinstance",
"(",
"options",
",",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | sqs_delete_queue | 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 its operations. Alternatively, pass in an existing `bot... | astrobase/awsutils.py | 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... | 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... | [
"This",
"deletes",
"an",
"SQS",
"queue",
"given",
"its",
"URL"
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L434-L467 | [
"def",
"sqs_delete_queue",
"(",
"queue_url",
",",
"client",
"=",
"None",
")",
":",
"if",
"not",
"client",
":",
"client",
"=",
"boto3",
".",
"client",
"(",
"'sqs'",
")",
"try",
":",
"client",
".",
"delete_queue",
"(",
"QueueUrl",
"=",
"queue_url",
")",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | sqs_put_item | This pushes a dict serialized to JSON to the specified SQS queue.
Parameters
----------
queue_url : str
The SQS URL of the queue to push the object to.
item : dict
The dict passed in here will be serialized to JSON.
delay_seconds : int
The amount of time in seconds the pu... | astrobase/awsutils.py | 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... | 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... | [
"This",
"pushes",
"a",
"dict",
"serialized",
"to",
"JSON",
"to",
"the",
"specified",
"SQS",
"queue",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L471-L534 | [
"def",
"sqs_put_item",
"(",
"queue_url",
",",
"item",
",",
"delay_seconds",
"=",
"0",
",",
"client",
"=",
"None",
",",
"raiseonfail",
"=",
"False",
")",
":",
"if",
"not",
"client",
":",
"client",
"=",
"boto3",
".",
"client",
"(",
"'sqs'",
")",
"try",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | sqs_get_item | 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 (`lcproc_aws.py`), the queue name will be
something like::
lcproc_queue_<action>
where action is one of::
runcp
runpf
The item is alway... | astrobase/awsutils.py | 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... | 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... | [
"This",
"gets",
"a",
"single",
"item",
"from",
"the",
"SQS",
"queue",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L538-L653 | [
"def",
"sqs_get_item",
"(",
"queue_url",
",",
"max_items",
"=",
"1",
",",
"wait_time_seconds",
"=",
"5",
",",
"client",
"=",
"None",
",",
"raiseonfail",
"=",
"False",
")",
":",
"if",
"not",
"client",
":",
"client",
"=",
"boto3",
".",
"client",
"(",
"'s... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | sqs_delete_item | This deletes a message from the queue, effectively acknowledging its
receipt.
Call this only when all messages retrieved from the queue have been
processed, since this will prevent redelivery of these messages to other
queue workers pulling fromn the same queue channel.
Parameters
----------
... | astrobase/awsutils.py | 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... | 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... | [
"This",
"deletes",
"a",
"message",
"from",
"the",
"queue",
"effectively",
"acknowledging",
"its",
"receipt",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L657-L714 | [
"def",
"sqs_delete_item",
"(",
"queue_url",
",",
"receipt_handle",
",",
"client",
"=",
"None",
",",
"raiseonfail",
"=",
"False",
")",
":",
"if",
"not",
"client",
":",
"client",
"=",
"boto3",
".",
"client",
"(",
"'sqs'",
")",
"try",
":",
"client",
".",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | make_ec2_nodes | This makes new EC2 worker nodes.
This requires a security group ID attached to a VPC config and subnet, a
keypair generated beforehand, and an IAM role ARN for the instance. See:
https://docs.aws.amazon.com/cli/latest/userguide/tutorial-ec2-ubuntu.html
Use `user_data` to launch tasks on instance laun... | astrobase/awsutils.py | def make_ec2_nodes(
security_groupid,
subnet_id,
keypair_name,
iam_instance_profile_arn,
launch_instances=1,
ami='ami-04681a1dbd79675a5',
instance='t3.micro',
ebs_optimized=True,
user_data=None,
wait_until_up=True,
client=None,
... | def make_ec2_nodes(
security_groupid,
subnet_id,
keypair_name,
iam_instance_profile_arn,
launch_instances=1,
ami='ami-04681a1dbd79675a5',
instance='t3.micro',
ebs_optimized=True,
user_data=None,
wait_until_up=True,
client=None,
... | [
"This",
"makes",
"new",
"EC2",
"worker",
"nodes",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L731-L952 | [
"def",
"make_ec2_nodes",
"(",
"security_groupid",
",",
"subnet_id",
",",
"keypair_name",
",",
"iam_instance_profile_arn",
",",
"launch_instances",
"=",
"1",
",",
"ami",
"=",
"'ami-04681a1dbd79675a5'",
",",
"instance",
"=",
"'t3.micro'",
",",
"ebs_optimized",
"=",
"T... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | delete_ec2_nodes | 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 instantiate a new `boto3.Client` object to
use in its operations. Altern... | astrobase/awsutils.py | 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... | 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... | [
"This",
"deletes",
"EC2",
"nodes",
"and",
"terminates",
"the",
"instances",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L956-L987 | [
"def",
"delete_ec2_nodes",
"(",
"instance_id_list",
",",
"client",
"=",
"None",
")",
":",
"if",
"not",
"client",
":",
"client",
"=",
"boto3",
".",
"client",
"(",
"'ec2'",
")",
"resp",
"=",
"client",
".",
"terminate_instances",
"(",
"InstanceIds",
"=",
"ins... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | make_spot_fleet_cluster | This makes an EC2 spot-fleet cluster.
This requires a security group ID attached to a VPC config and subnet, a
keypair generated beforehand, and an IAM role ARN for the instance. See:
https://docs.aws.amazon.com/cli/latest/userguide/tutorial-ec2-ubuntu.html
Use `user_data` to launch tasks on instance... | astrobase/awsutils.py | def make_spot_fleet_cluster(
security_groupid,
subnet_id,
keypair_name,
iam_instance_profile_arn,
spot_fleet_iam_role,
target_capacity=20,
spot_price=0.4,
expires_days=7,
allocation_strategy='lowestPrice',
instance_types=SPOT_INSTANCE_TYPES... | def make_spot_fleet_cluster(
security_groupid,
subnet_id,
keypair_name,
iam_instance_profile_arn,
spot_fleet_iam_role,
target_capacity=20,
spot_price=0.4,
expires_days=7,
allocation_strategy='lowestPrice',
instance_types=SPOT_INSTANCE_TYPES... | [
"This",
"makes",
"an",
"EC2",
"spot",
"-",
"fleet",
"cluster",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L1037-L1279 | [
"def",
"make_spot_fleet_cluster",
"(",
"security_groupid",
",",
"subnet_id",
",",
"keypair_name",
",",
"iam_instance_profile_arn",
",",
"spot_fleet_iam_role",
",",
"target_capacity",
"=",
"20",
",",
"spot_price",
"=",
"0.4",
",",
"expires_days",
"=",
"7",
",",
"allo... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | delete_spot_fleet_cluster | 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 will instantiate a new `boto3.Client` object to
use in its operations. Alternatively... | astrobase/awsutils.py | 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... | 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... | [
"This",
"deletes",
"a",
"spot",
"-",
"fleet",
"cluster",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/awsutils.py#L1283-L1316 | [
"def",
"delete_spot_fleet_cluster",
"(",
"spot_fleet_reqid",
",",
"client",
"=",
"None",
",",
")",
":",
"if",
"not",
"client",
":",
"client",
"=",
"boto3",
".",
"client",
"(",
"'ec2'",
")",
"resp",
"=",
"client",
".",
"cancel_spot_fleet_requests",
"(",
"Spot... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | gcs_get_file | This gets a single file from a Google Cloud Storage bucket.
Parameters
----------
bucketname : str
The name of the GCS bucket to download the file from.
filename : str
The full name of the file to download, including all prefixes.
local_file : str
Path to where the downlo... | astrobase/gcputils.py | def gcs_get_file(bucketname,
filename,
local_file,
altexts=None,
client=None,
service_account_json=None,
raiseonfail=False):
"""This gets a single file from a Google Cloud Storage bucket.
Parameters
------... | def gcs_get_file(bucketname,
filename,
local_file,
altexts=None,
client=None,
service_account_json=None,
raiseonfail=False):
"""This gets a single file from a Google Cloud Storage bucket.
Parameters
------... | [
"This",
"gets",
"a",
"single",
"file",
"from",
"a",
"Google",
"Cloud",
"Storage",
"bucket",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/gcputils.py#L174-L266 | [
"def",
"gcs_get_file",
"(",
"bucketname",
",",
"filename",
",",
"local_file",
",",
"altexts",
"=",
"None",
",",
"client",
"=",
"None",
",",
"service_account_json",
"=",
"None",
",",
"raiseonfail",
"=",
"False",
")",
":",
"if",
"not",
"client",
":",
"if",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | gcs_get_url | This gets a single file from a Google Cloud Storage bucket.
This uses the gs:// URL instead of a bucket name and key.
Parameters
----------
url : str
GCS URL to download. This should begin with 'gs://'.
altexts : None or list of str
If not None, this is a list of alternate extens... | astrobase/gcputils.py | def gcs_get_url(url,
altexts=None,
client=None,
service_account_json=None,
raiseonfail=False):
"""This gets a single file from a Google Cloud Storage bucket.
This uses the gs:// URL instead of a bucket name and key.
Parameters
----------
... | def gcs_get_url(url,
altexts=None,
client=None,
service_account_json=None,
raiseonfail=False):
"""This gets a single file from a Google Cloud Storage bucket.
This uses the gs:// URL instead of a bucket name and key.
Parameters
----------
... | [
"This",
"gets",
"a",
"single",
"file",
"from",
"a",
"Google",
"Cloud",
"Storage",
"bucket",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/gcputils.py#L270-L324 | [
"def",
"gcs_get_url",
"(",
"url",
",",
"altexts",
"=",
"None",
",",
"client",
"=",
"None",
",",
"service_account_json",
"=",
"None",
",",
"raiseonfail",
"=",
"False",
")",
":",
"bucket_item",
"=",
"url",
".",
"replace",
"(",
"'gs://'",
",",
"''",
")",
... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | gcs_put_file | This puts a single file into a Google Cloud Storage bucket.
Parameters
----------
local_file : str
Path to the file to upload to GCS.
bucket : str
The GCS bucket to upload the file to.
service_account_json : str
Path to a downloaded GCS credentials JSON file.
client ... | astrobase/gcputils.py | 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... | 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... | [
"This",
"puts",
"a",
"single",
"file",
"into",
"a",
"Google",
"Cloud",
"Storage",
"bucket",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/gcputils.py#L328-L392 | [
"def",
"gcs_put_file",
"(",
"local_file",
",",
"bucketname",
",",
"service_account_json",
"=",
"None",
",",
"client",
"=",
"None",
",",
"raiseonfail",
"=",
"False",
")",
":",
"if",
"not",
"client",
":",
"if",
"(",
"service_account_json",
"is",
"not",
"None",... | 2922a14619d183fb28005fa7d02027ac436f2265 |
valid | read_hatlc | This reads a consolidated HAT LC written by the functions above.
Returns a dict. | astrobase/hatsurveys/oldhatlc.py | def read_hatlc(hatlc):
'''
This reads a consolidated HAT LC written by the functions above.
Returns a dict.
'''
lcfname = os.path.basename(hatlc)
# unzip the files first
if '.gz' in lcfname:
lcf = gzip.open(hatlc,'rb')
elif '.bz2' in lcfname:
lcf = bz2.BZ2File(hatlc, ... | def read_hatlc(hatlc):
'''
This reads a consolidated HAT LC written by the functions above.
Returns a dict.
'''
lcfname = os.path.basename(hatlc)
# unzip the files first
if '.gz' in lcfname:
lcf = gzip.open(hatlc,'rb')
elif '.bz2' in lcfname:
lcf = bz2.BZ2File(hatlc, ... | [
"This",
"reads",
"a",
"consolidated",
"HAT",
"LC",
"written",
"by",
"the",
"functions",
"above",
"."
] | waqasbhatti/astrobase | python | https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/oldhatlc.py#L187-L310 | [
"def",
"read_hatlc",
"(",
"hatlc",
")",
":",
"lcfname",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"hatlc",
")",
"# unzip the files first",
"if",
"'.gz'",
"in",
"lcfname",
":",
"lcf",
"=",
"gzip",
".",
"open",
"(",
"hatlc",
",",
"'rb'",
")",
"elif",... | 2922a14619d183fb28005fa7d02027ac436f2265 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.