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
train
nan_acf
Calculate the autocorrelation function of the noise where the noise is a 2d array that may contain nans Parameters ---------- noise : 2d-array Noise image. Returns ------- acf : 2d-array The ACF.
AegeanTools/fitting.py
def nan_acf(noise): """ Calculate the autocorrelation function of the noise where the noise is a 2d array that may contain nans Parameters ---------- noise : 2d-array Noise image. Returns ------- acf : 2d-array The ACF. """ corr = np.zeros(noise.shape) ...
def nan_acf(noise): """ Calculate the autocorrelation function of the noise where the noise is a 2d array that may contain nans Parameters ---------- noise : 2d-array Noise image. Returns ------- acf : 2d-array The ACF. """ corr = np.zeros(noise.shape) ...
[ "Calculate", "the", "autocorrelation", "function", "of", "the", "noise", "where", "the", "noise", "is", "a", "2d", "array", "that", "may", "contain", "nans" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L618-L647
[ "def", "nan_acf", "(", "noise", ")", ":", "corr", "=", "np", ".", "zeros", "(", "noise", ".", "shape", ")", "ix", ",", "jx", "=", "noise", ".", "shape", "for", "i", "in", "range", "(", "ix", ")", ":", "si_min", "=", "slice", "(", "i", ",", "N...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
make_ita
Create the matrix ita of the noise where the noise may be a masked array where ita(x,y) is the correlation between pixel pairs that have the same separation as x and y. Parameters ---------- noise : 2d-array The noise image acf : 2d-array The autocorrelation matrix. (None = calcula...
AegeanTools/fitting.py
def make_ita(noise, acf=None): """ Create the matrix ita of the noise where the noise may be a masked array where ita(x,y) is the correlation between pixel pairs that have the same separation as x and y. Parameters ---------- noise : 2d-array The noise image acf : 2d-array ...
def make_ita(noise, acf=None): """ Create the matrix ita of the noise where the noise may be a masked array where ita(x,y) is the correlation between pixel pairs that have the same separation as x and y. Parameters ---------- noise : 2d-array The noise image acf : 2d-array ...
[ "Create", "the", "matrix", "ita", "of", "the", "noise", "where", "the", "noise", "may", "be", "a", "masked", "array", "where", "ita", "(", "x", "y", ")", "is", "the", "correlation", "between", "pixel", "pairs", "that", "have", "the", "same", "separation"...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L650-L682
[ "def", "make_ita", "(", "noise", ",", "acf", "=", "None", ")", ":", "if", "acf", "is", "None", ":", "acf", "=", "nan_acf", "(", "noise", ")", "# s should be the number of non-masked pixels", "s", "=", "np", ".", "count_nonzero", "(", "np", ".", "isfinite",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
RB_bias
Calculate the expected bias on each of the parameters in the model pars. Only parameters that are allowed to vary will have a bias. Calculation follows the description of Refrieger & Brown 1998 (cite). Parameters ---------- data : 2d-array data that was fit pars : lmfit.Parameters ...
AegeanTools/fitting.py
def RB_bias(data, pars, ita=None, acf=None): """ Calculate the expected bias on each of the parameters in the model pars. Only parameters that are allowed to vary will have a bias. Calculation follows the description of Refrieger & Brown 1998 (cite). Parameters ---------- data : 2d-array ...
def RB_bias(data, pars, ita=None, acf=None): """ Calculate the expected bias on each of the parameters in the model pars. Only parameters that are allowed to vary will have a bias. Calculation follows the description of Refrieger & Brown 1998 (cite). Parameters ---------- data : 2d-array ...
[ "Calculate", "the", "expected", "bias", "on", "each", "of", "the", "parameters", "in", "the", "model", "pars", ".", "Only", "parameters", "that", "are", "allowed", "to", "vary", "will", "have", "a", "bias", ".", "Calculation", "follows", "the", "description"...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L685-L757
[ "def", "RB_bias", "(", "data", ",", "pars", ",", "ita", "=", "None", ",", "acf", "=", "None", ")", ":", "log", ".", "info", "(", "\"data {0}\"", ".", "format", "(", "data", ".", "shape", ")", ")", "nparams", "=", "np", ".", "sum", "(", "[", "pa...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
bias_correct
Calculate and apply a bias correction to the given fit parameters Parameters ---------- params : lmfit.Parameters The model parameters. These will be modified. data : 2d-array The data which was used in the fitting acf : 2d-array ACF of the data. Default = None. Retu...
AegeanTools/fitting.py
def bias_correct(params, data, acf=None): """ Calculate and apply a bias correction to the given fit parameters Parameters ---------- params : lmfit.Parameters The model parameters. These will be modified. data : 2d-array The data which was used in the fitting acf : 2d-ar...
def bias_correct(params, data, acf=None): """ Calculate and apply a bias correction to the given fit parameters Parameters ---------- params : lmfit.Parameters The model parameters. These will be modified. data : 2d-array The data which was used in the fitting acf : 2d-ar...
[ "Calculate", "and", "apply", "a", "bias", "correction", "to", "the", "given", "fit", "parameters" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L760-L792
[ "def", "bias_correct", "(", "params", ",", "data", ",", "acf", "=", "None", ")", ":", "bias", "=", "RB_bias", "(", "data", ",", "params", ",", "acf", "=", "acf", ")", "i", "=", "0", "for", "p", "in", "params", ":", "if", "'theta'", "in", "p", "...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
condon_errors
Calculate the parameter errors for a fitted source using the description of Condon'97 All parameters are assigned errors, assuming that all params were fit. If some params were held fixed then these errors are overestimated. Parameters ---------- source : :class:`AegeanTools.models.SimpleSource...
AegeanTools/fitting.py
def condon_errors(source, theta_n, psf=None): """ Calculate the parameter errors for a fitted source using the description of Condon'97 All parameters are assigned errors, assuming that all params were fit. If some params were held fixed then these errors are overestimated. Parameters -----...
def condon_errors(source, theta_n, psf=None): """ Calculate the parameter errors for a fitted source using the description of Condon'97 All parameters are assigned errors, assuming that all params were fit. If some params were held fixed then these errors are overestimated. Parameters -----...
[ "Calculate", "the", "parameter", "errors", "for", "a", "fitted", "source", "using", "the", "description", "of", "Condon", "97", "All", "parameters", "are", "assigned", "errors", "assuming", "that", "all", "params", "were", "fit", ".", "If", "some", "params", ...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L795-L868
[ "def", "condon_errors", "(", "source", ",", "theta_n", ",", "psf", "=", "None", ")", ":", "# indices for the calculation or rho", "alphas", "=", "{", "'amp'", ":", "(", "3.", "/", "2", ",", "3.", "/", "2", ")", ",", "'major'", ":", "(", "5.", "/", "2...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
errors
Convert pixel based errors into sky coord errors Parameters ---------- source : :class:`AegeanTools.models.SimpleSource` The source which was fit. model : lmfit.Parameters The model which was fit. wcshelper : :class:`AegeanTools.wcs_helpers.WCSHelper` WCS information. ...
AegeanTools/fitting.py
def errors(source, model, wcshelper): """ Convert pixel based errors into sky coord errors Parameters ---------- source : :class:`AegeanTools.models.SimpleSource` The source which was fit. model : lmfit.Parameters The model which was fit. wcshelper : :class:`AegeanTools.wc...
def errors(source, model, wcshelper): """ Convert pixel based errors into sky coord errors Parameters ---------- source : :class:`AegeanTools.models.SimpleSource` The source which was fit. model : lmfit.Parameters The model which was fit. wcshelper : :class:`AegeanTools.wc...
[ "Convert", "pixel", "based", "errors", "into", "sky", "coord", "errors" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L871-L969
[ "def", "errors", "(", "source", ",", "model", ",", "wcshelper", ")", ":", "# if the source wasn't fit then all errors are -1", "if", "source", ".", "flags", "&", "(", "flags", ".", "NOTFIT", "|", "flags", ".", "FITERR", ")", ":", "source", ".", "err_peak_flux"...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
new_errors
Convert pixel based errors into sky coord errors Uses covariance matrix for ra/dec errors and calculus approach to a/b/pa errors Parameters ---------- source : :class:`AegeanTools.models.SimpleSource` The source which was fit. model : lmfit.Parameters The model which was fit. ...
AegeanTools/fitting.py
def new_errors(source, model, wcshelper): # pragma: no cover """ Convert pixel based errors into sky coord errors Uses covariance matrix for ra/dec errors and calculus approach to a/b/pa errors Parameters ---------- source : :class:`AegeanTools.models.SimpleSource` The source which...
def new_errors(source, model, wcshelper): # pragma: no cover """ Convert pixel based errors into sky coord errors Uses covariance matrix for ra/dec errors and calculus approach to a/b/pa errors Parameters ---------- source : :class:`AegeanTools.models.SimpleSource` The source which...
[ "Convert", "pixel", "based", "errors", "into", "sky", "coord", "errors", "Uses", "covariance", "matrix", "for", "ra", "/", "dec", "errors", "and", "calculus", "approach", "to", "a", "/", "b", "/", "pa", "errors" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L972-L1088
[ "def", "new_errors", "(", "source", ",", "model", ",", "wcshelper", ")", ":", "# pragma: no cover", "# if the source wasn't fit then all errors are -1", "if", "source", ".", "flags", "&", "(", "flags", ".", "NOTFIT", "|", "flags", ".", "FITERR", ")", ":", "sourc...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
ntwodgaussian_lmfit
Convert an lmfit.Parameters object into a function which calculates the model. Parameters ---------- params : lmfit.Parameters Model parameters, can have multiple components. Returns ------- model : func A function f(x,y) that will compute the model.
AegeanTools/fitting.py
def ntwodgaussian_lmfit(params): """ Convert an lmfit.Parameters object into a function which calculates the model. Parameters ---------- params : lmfit.Parameters Model parameters, can have multiple components. Returns ------- model : func A function f(x,y) that will ...
def ntwodgaussian_lmfit(params): """ Convert an lmfit.Parameters object into a function which calculates the model. Parameters ---------- params : lmfit.Parameters Model parameters, can have multiple components. Returns ------- model : func A function f(x,y) that will ...
[ "Convert", "an", "lmfit", ".", "Parameters", "object", "into", "a", "function", "which", "calculates", "the", "model", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L1091-L1137
[ "def", "ntwodgaussian_lmfit", "(", "params", ")", ":", "def", "rfunc", "(", "x", ",", "y", ")", ":", "\"\"\"\n Compute the model given by params, at pixel coordinates x,y\n\n Parameters\n ----------\n x, y : numpy.ndarray\n The x/y pixel coordinates...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
do_lmfit
Fit the model to the data data may contain 'flagged' or 'masked' data with the value of np.NaN Parameters ---------- data : 2d-array Image data params : lmfit.Parameters Initial model guess. B : 2d-array B matrix to be used in residual calculations. Default = N...
AegeanTools/fitting.py
def do_lmfit(data, params, B=None, errs=None, dojac=True): """ Fit the model to the data data may contain 'flagged' or 'masked' data with the value of np.NaN Parameters ---------- data : 2d-array Image data params : lmfit.Parameters Initial model guess. B : 2d-array ...
def do_lmfit(data, params, B=None, errs=None, dojac=True): """ Fit the model to the data data may contain 'flagged' or 'masked' data with the value of np.NaN Parameters ---------- data : 2d-array Image data params : lmfit.Parameters Initial model guess. B : 2d-array ...
[ "Fit", "the", "model", "to", "the", "data", "data", "may", "contain", "flagged", "or", "masked", "data", "with", "the", "value", "of", "np", ".", "NaN" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L1140-L1210
[ "def", "do_lmfit", "(", "data", ",", "params", ",", "B", "=", "None", ",", "errs", "=", "None", ",", "dojac", "=", "True", ")", ":", "# copy the params so as not to change the initial conditions", "# in case we want to use them elsewhere", "params", "=", "copy", "."...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
covar_errors
Take a set of parameters that were fit with lmfit, and replace the errors with the 1\sigma errors calculated using the covariance matrix. Parameters ---------- params : lmfit.Parameters Model data : 2d-array Image data errs : 2d-array ? Image noise. B : 2d-array ...
AegeanTools/fitting.py
def covar_errors(params, data, errs, B, C=None): """ Take a set of parameters that were fit with lmfit, and replace the errors with the 1\sigma errors calculated using the covariance matrix. Parameters ---------- params : lmfit.Parameters Model data : 2d-array Image data ...
def covar_errors(params, data, errs, B, C=None): """ Take a set of parameters that were fit with lmfit, and replace the errors with the 1\sigma errors calculated using the covariance matrix. Parameters ---------- params : lmfit.Parameters Model data : 2d-array Image data ...
[ "Take", "a", "set", "of", "parameters", "that", "were", "fit", "with", "lmfit", "and", "replace", "the", "errors", "with", "the", "1", "\\", "sigma", "errors", "calculated", "using", "the", "covariance", "matrix", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L1213-L1269
[ "def", "covar_errors", "(", "params", ",", "data", ",", "errs", ",", "B", ",", "C", "=", "None", ")", ":", "mask", "=", "np", ".", "where", "(", "np", ".", "isfinite", "(", "data", ")", ")", "# calculate the proper parameter errors and copy them across.", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
barrier
act as a multiprocessing barrier
AegeanTools/BANE.py
def barrier(events, sid, kind='neighbour'): """ act as a multiprocessing barrier """ events[sid].set() # only wait for the neighbours if kind=='neighbour': if sid > 0: logging.debug("{0} is waiting for {1}".format(sid, sid - 1)) events[sid - 1].wait() if s...
def barrier(events, sid, kind='neighbour'): """ act as a multiprocessing barrier """ events[sid].set() # only wait for the neighbours if kind=='neighbour': if sid > 0: logging.debug("{0} is waiting for {1}".format(sid, sid - 1)) events[sid - 1].wait() if s...
[ "act", "as", "a", "multiprocessing", "barrier" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/BANE.py#L34-L50
[ "def", "barrier", "(", "events", ",", "sid", ",", "kind", "=", "'neighbour'", ")", ":", "events", "[", "sid", "]", ".", "set", "(", ")", "# only wait for the neighbours", "if", "kind", "==", "'neighbour'", ":", "if", "sid", ">", "0", ":", "logging", "....
185d2b4a51b48441a1df747efc9a5271c79399fd
train
sigmaclip
Perform sigma clipping on an array, ignoring non finite values. During each iteration return an array whose elements c obey: mean -std*lo < c < mean + std*hi where mean/std are the mean std of the input array. Parameters ---------- arr : iterable An iterable array of numeric types. ...
AegeanTools/BANE.py
def sigmaclip(arr, lo, hi, reps=3): """ Perform sigma clipping on an array, ignoring non finite values. During each iteration return an array whose elements c obey: mean -std*lo < c < mean + std*hi where mean/std are the mean std of the input array. Parameters ---------- arr : iterabl...
def sigmaclip(arr, lo, hi, reps=3): """ Perform sigma clipping on an array, ignoring non finite values. During each iteration return an array whose elements c obey: mean -std*lo < c < mean + std*hi where mean/std are the mean std of the input array. Parameters ---------- arr : iterabl...
[ "Perform", "sigma", "clipping", "on", "an", "array", "ignoring", "non", "finite", "values", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/BANE.py#L53-L102
[ "def", "sigmaclip", "(", "arr", ",", "lo", ",", "hi", ",", "reps", "=", "3", ")", ":", "clipped", "=", "np", ".", "array", "(", "arr", ")", "[", "np", ".", "isfinite", "(", "arr", ")", "]", "if", "len", "(", "clipped", ")", "<", "1", ":", "...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
_sf2
A shallow wrapper for sigma_filter. Parameters ---------- args : list A list of arguments for sigma_filter Returns ------- None
AegeanTools/BANE.py
def _sf2(args): """ A shallow wrapper for sigma_filter. Parameters ---------- args : list A list of arguments for sigma_filter Returns ------- None """ # an easier to debug traceback when multiprocessing # thanks to https://stackoverflow.com/a/16618842/1710603 t...
def _sf2(args): """ A shallow wrapper for sigma_filter. Parameters ---------- args : list A list of arguments for sigma_filter Returns ------- None """ # an easier to debug traceback when multiprocessing # thanks to https://stackoverflow.com/a/16618842/1710603 t...
[ "A", "shallow", "wrapper", "for", "sigma_filter", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/BANE.py#L105-L124
[ "def", "_sf2", "(", "args", ")", ":", "# an easier to debug traceback when multiprocessing", "# thanks to https://stackoverflow.com/a/16618842/1710603", "try", ":", "return", "sigma_filter", "(", "*", "args", ")", "except", ":", "import", "traceback", "raise", "Exception", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
sigma_filter
Calculate the background and rms for a sub region of an image. The results are written to shared memory - irms and ibkg. Parameters ---------- filename : string Fits file to open region : list Region within the fits file that is to be processed. (row_min, row_max). step_size :...
AegeanTools/BANE.py
def sigma_filter(filename, region, step_size, box_size, shape, domask, sid): """ Calculate the background and rms for a sub region of an image. The results are written to shared memory - irms and ibkg. Parameters ---------- filename : string Fits file to open region : list ...
def sigma_filter(filename, region, step_size, box_size, shape, domask, sid): """ Calculate the background and rms for a sub region of an image. The results are written to shared memory - irms and ibkg. Parameters ---------- filename : string Fits file to open region : list ...
[ "Calculate", "the", "background", "and", "rms", "for", "a", "sub", "region", "of", "an", "image", ".", "The", "results", "are", "written", "to", "shared", "memory", "-", "irms", "and", "ibkg", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/BANE.py#L127-L267
[ "def", "sigma_filter", "(", "filename", ",", "region", ",", "step_size", ",", "box_size", ",", "shape", ",", "domask", ",", "sid", ")", ":", "ymin", ",", "ymax", "=", "region", "logging", ".", "debug", "(", "'rows {0}-{1} starting at {2}'", ".", "format", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
filter_mc_sharemem
Calculate the background and noise images corresponding to the input file. The calculation is done via a box-car approach and uses multiple cores and shared memory. Parameters ---------- filename : str Filename to be filtered. step_size : (int, int) Step size for the filter. b...
AegeanTools/BANE.py
def filter_mc_sharemem(filename, step_size, box_size, cores, shape, nslice=None, domask=True): """ Calculate the background and noise images corresponding to the input file. The calculation is done via a box-car approach and uses multiple cores and shared memory. Parameters ---------- filename ...
def filter_mc_sharemem(filename, step_size, box_size, cores, shape, nslice=None, domask=True): """ Calculate the background and noise images corresponding to the input file. The calculation is done via a box-car approach and uses multiple cores and shared memory. Parameters ---------- filename ...
[ "Calculate", "the", "background", "and", "noise", "images", "corresponding", "to", "the", "input", "file", ".", "The", "calculation", "is", "done", "via", "a", "box", "-", "car", "approach", "and", "uses", "multiple", "cores", "and", "shared", "memory", "." ...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/BANE.py#L270-L363
[ "def", "filter_mc_sharemem", "(", "filename", ",", "step_size", ",", "box_size", ",", "cores", ",", "shape", ",", "nslice", "=", "None", ",", "domask", "=", "True", ")", ":", "if", "cores", "is", "None", ":", "cores", "=", "multiprocessing", ".", "cpu_co...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
filter_image
Create a background and noise image from an input image. Resulting images are written to `outbase_bkg.fits` and `outbase_rms.fits` Parameters ---------- im_name : str or HDUList Image to filter. Either a string filename or an astropy.io.fits.HDUList. out_base : str The output filena...
AegeanTools/BANE.py
def filter_image(im_name, out_base, step_size=None, box_size=None, twopass=False, cores=None, mask=True, compressed=False, nslice=None): """ Create a background and noise image from an input image. Resulting images are written to `outbase_bkg.fits` and `outbase_rms.fits` Parameters ---------- i...
def filter_image(im_name, out_base, step_size=None, box_size=None, twopass=False, cores=None, mask=True, compressed=False, nslice=None): """ Create a background and noise image from an input image. Resulting images are written to `outbase_bkg.fits` and `outbase_rms.fits` Parameters ---------- i...
[ "Create", "a", "background", "and", "noise", "image", "from", "an", "input", "image", ".", "Resulting", "images", "are", "written", "to", "outbase_bkg", ".", "fits", "and", "outbase_rms", ".", "fits" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/BANE.py#L366-L461
[ "def", "filter_image", "(", "im_name", ",", "out_base", ",", "step_size", "=", "None", ",", "box_size", "=", "None", ",", "twopass", "=", "False", ",", "cores", "=", "None", ",", "mask", "=", "True", ",", "compressed", "=", "False", ",", "nslice", "=",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
write_fits
Combine data and a fits header to write a fits file. Parameters ---------- data : numpy.ndarray The data to be written. header : astropy.io.fits.hduheader The header for the fits file. file_name : string The file to write Returns ------- None
AegeanTools/BANE.py
def write_fits(data, header, file_name): """ Combine data and a fits header to write a fits file. Parameters ---------- data : numpy.ndarray The data to be written. header : astropy.io.fits.hduheader The header for the fits file. file_name : string The file to writ...
def write_fits(data, header, file_name): """ Combine data and a fits header to write a fits file. Parameters ---------- data : numpy.ndarray The data to be written. header : astropy.io.fits.hduheader The header for the fits file. file_name : string The file to writ...
[ "Combine", "data", "and", "a", "fits", "header", "to", "write", "a", "fits", "file", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/BANE.py#L467-L491
[ "def", "write_fits", "(", "data", ",", "header", ",", "file_name", ")", ":", "hdu", "=", "fits", ".", "PrimaryHDU", "(", "data", ")", "hdu", ".", "header", "=", "header", "hdulist", "=", "fits", ".", "HDUList", "(", "[", "hdu", "]", ")", "hdulist", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
dec2dec
Convert sexegessimal RA string into a float in degrees. Parameters ---------- dec : string A string separated representing the Dec. Expected format is `[+- ]hh:mm[:ss.s]` Colons can be replaced with any whit space character. Returns ------- dec : float The Dec i...
AegeanTools/angle_tools.py
def dec2dec(dec): """ Convert sexegessimal RA string into a float in degrees. Parameters ---------- dec : string A string separated representing the Dec. Expected format is `[+- ]hh:mm[:ss.s]` Colons can be replaced with any whit space character. Returns ------- ...
def dec2dec(dec): """ Convert sexegessimal RA string into a float in degrees. Parameters ---------- dec : string A string separated representing the Dec. Expected format is `[+- ]hh:mm[:ss.s]` Colons can be replaced with any whit space character. Returns ------- ...
[ "Convert", "sexegessimal", "RA", "string", "into", "a", "float", "in", "degrees", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/angle_tools.py#L38-L59
[ "def", "dec2dec", "(", "dec", ")", ":", "d", "=", "dec", ".", "replace", "(", "':'", ",", "' '", ")", ".", "split", "(", ")", "if", "len", "(", "d", ")", "==", "2", ":", "d", ".", "append", "(", "0.0", ")", "if", "d", "[", "0", "]", ".", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
dec2dms
Convert decimal degrees into a sexagessimal string in degrees. Parameters ---------- x : float Angle in degrees Returns ------- dms : string String of format [+-]DD:MM:SS.SS or XX:XX:XX.XX if x is not finite.
AegeanTools/angle_tools.py
def dec2dms(x): """ Convert decimal degrees into a sexagessimal string in degrees. Parameters ---------- x : float Angle in degrees Returns ------- dms : string String of format [+-]DD:MM:SS.SS or XX:XX:XX.XX if x is not finite. """ if not np.isfinite(x)...
def dec2dms(x): """ Convert decimal degrees into a sexagessimal string in degrees. Parameters ---------- x : float Angle in degrees Returns ------- dms : string String of format [+-]DD:MM:SS.SS or XX:XX:XX.XX if x is not finite. """ if not np.isfinite(x)...
[ "Convert", "decimal", "degrees", "into", "a", "sexagessimal", "string", "in", "degrees", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/angle_tools.py#L62-L87
[ "def", "dec2dms", "(", "x", ")", ":", "if", "not", "np", ".", "isfinite", "(", "x", ")", ":", "return", "'XX:XX:XX.XX'", "if", "x", "<", "0", ":", "sign", "=", "'-'", "else", ":", "sign", "=", "'+'", "x", "=", "abs", "(", "x", ")", "d", "=", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
dec2hms
Convert decimal degrees into a sexagessimal string in hours. Parameters ---------- x : float Angle in degrees Returns ------- dms : string String of format HH:MM:SS.SS or XX:XX:XX.XX if x is not finite.
AegeanTools/angle_tools.py
def dec2hms(x): """ Convert decimal degrees into a sexagessimal string in hours. Parameters ---------- x : float Angle in degrees Returns ------- dms : string String of format HH:MM:SS.SS or XX:XX:XX.XX if x is not finite. """ if not np.isfinite(x): ...
def dec2hms(x): """ Convert decimal degrees into a sexagessimal string in hours. Parameters ---------- x : float Angle in degrees Returns ------- dms : string String of format HH:MM:SS.SS or XX:XX:XX.XX if x is not finite. """ if not np.isfinite(x): ...
[ "Convert", "decimal", "degrees", "into", "a", "sexagessimal", "string", "in", "hours", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/angle_tools.py#L90-L115
[ "def", "dec2hms", "(", "x", ")", ":", "if", "not", "np", ".", "isfinite", "(", "x", ")", ":", "return", "'XX:XX:XX.XX'", "# wrap negative RA's", "if", "x", "<", "0", ":", "x", "+=", "360", "x", "/=", "15.0", "h", "=", "int", "(", "x", ")", "x", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
gcd
Calculate the great circle distance between to points using the haversine formula [1]_. Parameters ---------- ra1, dec1, ra2, dec2 : float The coordinates of the two points of interest. Units are in degrees. Returns ------- dist : float The distance between the two poi...
AegeanTools/angle_tools.py
def gcd(ra1, dec1, ra2, dec2): """ Calculate the great circle distance between to points using the haversine formula [1]_. Parameters ---------- ra1, dec1, ra2, dec2 : float The coordinates of the two points of interest. Units are in degrees. Returns ------- dist : flo...
def gcd(ra1, dec1, ra2, dec2): """ Calculate the great circle distance between to points using the haversine formula [1]_. Parameters ---------- ra1, dec1, ra2, dec2 : float The coordinates of the two points of interest. Units are in degrees. Returns ------- dist : flo...
[ "Calculate", "the", "great", "circle", "distance", "between", "to", "points", "using", "the", "haversine", "formula", "[", "1", "]", "_", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/angle_tools.py#L121-L149
[ "def", "gcd", "(", "ra1", ",", "dec1", ",", "ra2", ",", "dec2", ")", ":", "# TODO: Vincenty formula see - https://en.wikipedia.org/wiki/Great-circle_distance", "dlon", "=", "ra2", "-", "ra1", "dlat", "=", "dec2", "-", "dec1", "a", "=", "np", ".", "sin", "(", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
bear
Calculate the bearing of point 2 from point 1 along a great circle. The bearing is East of North and is in [0, 360), whereas position angle is also East of North but (-180,180] Parameters ---------- ra1, dec1, ra2, dec2 : float The sky coordinates (degrees) of the two points. Returns -...
AegeanTools/angle_tools.py
def bear(ra1, dec1, ra2, dec2): """ Calculate the bearing of point 2 from point 1 along a great circle. The bearing is East of North and is in [0, 360), whereas position angle is also East of North but (-180,180] Parameters ---------- ra1, dec1, ra2, dec2 : float The sky coordinates (de...
def bear(ra1, dec1, ra2, dec2): """ Calculate the bearing of point 2 from point 1 along a great circle. The bearing is East of North and is in [0, 360), whereas position angle is also East of North but (-180,180] Parameters ---------- ra1, dec1, ra2, dec2 : float The sky coordinates (de...
[ "Calculate", "the", "bearing", "of", "point", "2", "from", "point", "1", "along", "a", "great", "circle", ".", "The", "bearing", "is", "East", "of", "North", "and", "is", "in", "[", "0", "360", ")", "whereas", "position", "angle", "is", "also", "East",...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/angle_tools.py#L152-L173
[ "def", "bear", "(", "ra1", ",", "dec1", ",", "ra2", ",", "dec2", ")", ":", "rdec1", "=", "np", ".", "radians", "(", "dec1", ")", "rdec2", "=", "np", ".", "radians", "(", "dec2", ")", "rdlon", "=", "np", ".", "radians", "(", "ra2", "-", "ra1", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
translate
Translate a given point a distance r in the (initial) direction theta, along a great circle. Parameters ---------- ra, dec : float The initial point of interest (degrees). r, theta : float The distance and initial direction to translate (degrees). Returns ------- ra, dec ...
AegeanTools/angle_tools.py
def translate(ra, dec, r, theta): """ Translate a given point a distance r in the (initial) direction theta, along a great circle. Parameters ---------- ra, dec : float The initial point of interest (degrees). r, theta : float The distance and initial direction to translate (d...
def translate(ra, dec, r, theta): """ Translate a given point a distance r in the (initial) direction theta, along a great circle. Parameters ---------- ra, dec : float The initial point of interest (degrees). r, theta : float The distance and initial direction to translate (d...
[ "Translate", "a", "given", "point", "a", "distance", "r", "in", "the", "(", "initial", ")", "direction", "theta", "along", "a", "great", "circle", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/angle_tools.py#L176-L200
[ "def", "translate", "(", "ra", ",", "dec", ",", "r", ",", "theta", ")", ":", "factor", "=", "np", ".", "sin", "(", "np", ".", "radians", "(", "dec", ")", ")", "*", "np", ".", "cos", "(", "np", ".", "radians", "(", "r", ")", ")", "factor", "...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
dist_rhumb
Calculate the Rhumb line distance between two points [1]_. A Rhumb line between two points is one which follows a constant bearing. Parameters ---------- ra1, dec1, ra2, dec2 : float The position of the two points (degrees). Returns ------- dist : float The distance between...
AegeanTools/angle_tools.py
def dist_rhumb(ra1, dec1, ra2, dec2): """ Calculate the Rhumb line distance between two points [1]_. A Rhumb line between two points is one which follows a constant bearing. Parameters ---------- ra1, dec1, ra2, dec2 : float The position of the two points (degrees). Returns ---...
def dist_rhumb(ra1, dec1, ra2, dec2): """ Calculate the Rhumb line distance between two points [1]_. A Rhumb line between two points is one which follows a constant bearing. Parameters ---------- ra1, dec1, ra2, dec2 : float The position of the two points (degrees). Returns ---...
[ "Calculate", "the", "Rhumb", "line", "distance", "between", "two", "points", "[", "1", "]", "_", ".", "A", "Rhumb", "line", "between", "two", "points", "is", "one", "which", "follows", "a", "constant", "bearing", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/angle_tools.py#L203-L237
[ "def", "dist_rhumb", "(", "ra1", ",", "dec1", ",", "ra2", ",", "dec2", ")", ":", "# verified against website to give correct results", "phi1", "=", "np", ".", "radians", "(", "dec1", ")", "phi2", "=", "np", ".", "radians", "(", "dec2", ")", "dphi", "=", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
bear_rhumb
Calculate the bearing of point 2 from point 1 along a Rhumb line. The bearing is East of North and is in [0, 360), whereas position angle is also East of North but (-180,180] Parameters ---------- ra1, dec1, ra2, dec2 : float The sky coordinates (degrees) of the two points. Returns ---...
AegeanTools/angle_tools.py
def bear_rhumb(ra1, dec1, ra2, dec2): """ Calculate the bearing of point 2 from point 1 along a Rhumb line. The bearing is East of North and is in [0, 360), whereas position angle is also East of North but (-180,180] Parameters ---------- ra1, dec1, ra2, dec2 : float The sky coordinates...
def bear_rhumb(ra1, dec1, ra2, dec2): """ Calculate the bearing of point 2 from point 1 along a Rhumb line. The bearing is East of North and is in [0, 360), whereas position angle is also East of North but (-180,180] Parameters ---------- ra1, dec1, ra2, dec2 : float The sky coordinates...
[ "Calculate", "the", "bearing", "of", "point", "2", "from", "point", "1", "along", "a", "Rhumb", "line", ".", "The", "bearing", "is", "East", "of", "North", "and", "is", "in", "[", "0", "360", ")", "whereas", "position", "angle", "is", "also", "East", ...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/angle_tools.py#L240-L265
[ "def", "bear_rhumb", "(", "ra1", ",", "dec1", ",", "ra2", ",", "dec2", ")", ":", "# verified against website to give correct results", "phi1", "=", "np", ".", "radians", "(", "dec1", ")", "phi2", "=", "np", ".", "radians", "(", "dec2", ")", "lambda1", "=",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
translate_rhumb
Translate a given point a distance r in the (initial) direction theta, along a Rhumb line. Parameters ---------- ra, dec : float The initial point of interest (degrees). r, theta : float The distance and initial direction to translate (degrees). Returns ------- ra, dec : fl...
AegeanTools/angle_tools.py
def translate_rhumb(ra, dec, r, theta): """ Translate a given point a distance r in the (initial) direction theta, along a Rhumb line. Parameters ---------- ra, dec : float The initial point of interest (degrees). r, theta : float The distance and initial direction to translate ...
def translate_rhumb(ra, dec, r, theta): """ Translate a given point a distance r in the (initial) direction theta, along a Rhumb line. Parameters ---------- ra, dec : float The initial point of interest (degrees). r, theta : float The distance and initial direction to translate ...
[ "Translate", "a", "given", "point", "a", "distance", "r", "in", "the", "(", "initial", ")", "direction", "theta", "along", "a", "Rhumb", "line", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/angle_tools.py#L268-L303
[ "def", "translate_rhumb", "(", "ra", ",", "dec", ",", "r", ",", "theta", ")", ":", "# verified against website to give correct results", "# with the help of http://williams.best.vwh.net/avform.htm#Rhumb", "delta", "=", "np", ".", "radians", "(", "r", ")", "phi1", "=", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
galactic2fk5
Convert galactic l/b to fk5 ra/dec Parameters ---------- l, b : float Galactic coordinates in radians. Returns ------- ra, dec : float FK5 ecliptic coordinates in radians.
AegeanTools/MIMAS.py
def galactic2fk5(l, b): """ Convert galactic l/b to fk5 ra/dec Parameters ---------- l, b : float Galactic coordinates in radians. Returns ------- ra, dec : float FK5 ecliptic coordinates in radians. """ a = SkyCoord(l, b, unit=(u.radian, u.radian), frame='galac...
def galactic2fk5(l, b): """ Convert galactic l/b to fk5 ra/dec Parameters ---------- l, b : float Galactic coordinates in radians. Returns ------- ra, dec : float FK5 ecliptic coordinates in radians. """ a = SkyCoord(l, b, unit=(u.radian, u.radian), frame='galac...
[ "Convert", "galactic", "l", "/", "b", "to", "fk5", "ra", "/", "dec" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/MIMAS.py#L77-L92
[ "def", "galactic2fk5", "(", "l", ",", "b", ")", ":", "a", "=", "SkyCoord", "(", "l", ",", "b", ",", "unit", "=", "(", "u", ".", "radian", ",", "u", ".", "radian", ")", ",", "frame", "=", "'galactic'", ")", "return", "a", ".", "fk5", ".", "ra"...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
mask_plane
Mask a 2d image (data) such that pixels within 'region' are set to nan. Parameters ---------- data : 2d-array Image array. wcs : astropy.wcs.WCS WCS for the image in question. region : :class:`AegeanTools.regions.Region` A region within which the image pixels will be maske...
AegeanTools/MIMAS.py
def mask_plane(data, wcs, region, negate=False): """ Mask a 2d image (data) such that pixels within 'region' are set to nan. Parameters ---------- data : 2d-array Image array. wcs : astropy.wcs.WCS WCS for the image in question. region : :class:`AegeanTools.regions.Region`...
def mask_plane(data, wcs, region, negate=False): """ Mask a 2d image (data) such that pixels within 'region' are set to nan. Parameters ---------- data : 2d-array Image array. wcs : astropy.wcs.WCS WCS for the image in question. region : :class:`AegeanTools.regions.Region`...
[ "Mask", "a", "2d", "image", "(", "data", ")", "such", "that", "pixels", "within", "region", "are", "set", "to", "nan", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/MIMAS.py#L95-L139
[ "def", "mask_plane", "(", "data", ",", "wcs", ",", "region", ",", "negate", "=", "False", ")", ":", "# create an array but don't set the values (they are random)", "indexes", "=", "np", ".", "empty", "(", "(", "data", ".", "shape", "[", "0", "]", "*", "data"...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
mask_file
Created a masked version of file, using a region. Parameters ---------- regionfile : str A file which can be loaded as a :class:`AegeanTools.regions.Region`. The image will be masked according to this region. infile : str Input FITS image. outfile : str Output FIT...
AegeanTools/MIMAS.py
def mask_file(regionfile, infile, outfile, negate=False): """ Created a masked version of file, using a region. Parameters ---------- regionfile : str A file which can be loaded as a :class:`AegeanTools.regions.Region`. The image will be masked according to this region. infile...
def mask_file(regionfile, infile, outfile, negate=False): """ Created a masked version of file, using a region. Parameters ---------- regionfile : str A file which can be loaded as a :class:`AegeanTools.regions.Region`. The image will be masked according to this region. infile...
[ "Created", "a", "masked", "version", "of", "file", "using", "a", "region", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/MIMAS.py#L142-L191
[ "def", "mask_file", "(", "regionfile", ",", "infile", ",", "outfile", ",", "negate", "=", "False", ")", ":", "# Check that the input file is accessible and then open it", "if", "not", "os", ".", "path", ".", "exists", "(", "infile", ")", ":", "raise", "Assertion...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
mask_table
Apply a given mask (region) to the table, removing all the rows with ra/dec inside the region If negate=False then remove the rows with ra/dec outside the region. Parameters ---------- region : :class:`AegeanTools.regions.Region` Region to mask. table : Astropy.table.Table Table t...
AegeanTools/MIMAS.py
def mask_table(region, table, negate=False, racol='ra', deccol='dec'): """ Apply a given mask (region) to the table, removing all the rows with ra/dec inside the region If negate=False then remove the rows with ra/dec outside the region. Parameters ---------- region : :class:`AegeanTools.regio...
def mask_table(region, table, negate=False, racol='ra', deccol='dec'): """ Apply a given mask (region) to the table, removing all the rows with ra/dec inside the region If negate=False then remove the rows with ra/dec outside the region. Parameters ---------- region : :class:`AegeanTools.regio...
[ "Apply", "a", "given", "mask", "(", "region", ")", "to", "the", "table", "removing", "all", "the", "rows", "with", "ra", "/", "dec", "inside", "the", "region", "If", "negate", "=", "False", "then", "remove", "the", "rows", "with", "ra", "/", "dec", "...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/MIMAS.py#L194-L226
[ "def", "mask_table", "(", "region", ",", "table", ",", "negate", "=", "False", ",", "racol", "=", "'ra'", ",", "deccol", "=", "'dec'", ")", ":", "inside", "=", "region", ".", "sky_within", "(", "table", "[", "racol", "]", ",", "table", "[", "deccol",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
mask_catalog
Apply a region file as a mask to a catalog, removing all the rows with ra/dec inside the region If negate=False then remove the rows with ra/dec outside the region. Parameters ---------- regionfile : str A file which can be loaded as a :class:`AegeanTools.regions.Region`. The catalogue...
AegeanTools/MIMAS.py
def mask_catalog(regionfile, infile, outfile, negate=False, racol='ra', deccol='dec'): """ Apply a region file as a mask to a catalog, removing all the rows with ra/dec inside the region If negate=False then remove the rows with ra/dec outside the region. Parameters ---------- regionfile : str...
def mask_catalog(regionfile, infile, outfile, negate=False, racol='ra', deccol='dec'): """ Apply a region file as a mask to a catalog, removing all the rows with ra/dec inside the region If negate=False then remove the rows with ra/dec outside the region. Parameters ---------- regionfile : str...
[ "Apply", "a", "region", "file", "as", "a", "mask", "to", "a", "catalog", "removing", "all", "the", "rows", "with", "ra", "/", "dec", "inside", "the", "region", "If", "negate", "=", "False", "then", "remove", "the", "rows", "with", "ra", "/", "dec", "...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/MIMAS.py#L229-L267
[ "def", "mask_catalog", "(", "regionfile", ",", "infile", ",", "outfile", ",", "negate", "=", "False", ",", "racol", "=", "'ra'", ",", "deccol", "=", "'dec'", ")", ":", "logging", ".", "info", "(", "\"Loading region from {0}\"", ".", "format", "(", "regionf...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
mim2reg
Convert a MIMAS region (.mim) file into a DS9 region (.reg) file. Parameters ---------- mimfile : str Input file in MIMAS format. regfile : str Output file.
AegeanTools/MIMAS.py
def mim2reg(mimfile, regfile): """ Convert a MIMAS region (.mim) file into a DS9 region (.reg) file. Parameters ---------- mimfile : str Input file in MIMAS format. regfile : str Output file. """ region = Region.load(mimfile) region.write_reg(regfile) logging.i...
def mim2reg(mimfile, regfile): """ Convert a MIMAS region (.mim) file into a DS9 region (.reg) file. Parameters ---------- mimfile : str Input file in MIMAS format. regfile : str Output file. """ region = Region.load(mimfile) region.write_reg(regfile) logging.i...
[ "Convert", "a", "MIMAS", "region", "(", ".", "mim", ")", "file", "into", "a", "DS9", "region", "(", ".", "reg", ")", "file", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/MIMAS.py#L270-L286
[ "def", "mim2reg", "(", "mimfile", ",", "regfile", ")", ":", "region", "=", "Region", ".", "load", "(", "mimfile", ")", "region", ".", "write_reg", "(", "regfile", ")", "logging", ".", "info", "(", "\"Converted {0} -> {1}\"", ".", "format", "(", "mimfile", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
mim2fits
Convert a MIMAS region (.mim) file into a MOC region (.fits) file. Parameters ---------- mimfile : str Input file in MIMAS format. fitsfile : str Output file.
AegeanTools/MIMAS.py
def mim2fits(mimfile, fitsfile): """ Convert a MIMAS region (.mim) file into a MOC region (.fits) file. Parameters ---------- mimfile : str Input file in MIMAS format. fitsfile : str Output file. """ region = Region.load(mimfile) region.write_fits(fitsfile, moctool=...
def mim2fits(mimfile, fitsfile): """ Convert a MIMAS region (.mim) file into a MOC region (.fits) file. Parameters ---------- mimfile : str Input file in MIMAS format. fitsfile : str Output file. """ region = Region.load(mimfile) region.write_fits(fitsfile, moctool=...
[ "Convert", "a", "MIMAS", "region", "(", ".", "mim", ")", "file", "into", "a", "MOC", "region", "(", ".", "fits", ")", "file", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/MIMAS.py#L289-L304
[ "def", "mim2fits", "(", "mimfile", ",", "fitsfile", ")", ":", "region", "=", "Region", ".", "load", "(", "mimfile", ")", "region", ".", "write_fits", "(", "fitsfile", ",", "moctool", "=", "'MIMAS {0}-{1}'", ".", "format", "(", "__version__", ",", "__date__...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
box2poly
Convert a string that describes a box in ds9 format, into a polygon that is given by the corners of the box Parameters ---------- line : str A string containing a DS9 region command for a box. Returns ------- poly : [ra, dec, ...] The corners of the box in clockwise order from ...
AegeanTools/MIMAS.py
def box2poly(line): """ Convert a string that describes a box in ds9 format, into a polygon that is given by the corners of the box Parameters ---------- line : str A string containing a DS9 region command for a box. Returns ------- poly : [ra, dec, ...] The corners of ...
def box2poly(line): """ Convert a string that describes a box in ds9 format, into a polygon that is given by the corners of the box Parameters ---------- line : str A string containing a DS9 region command for a box. Returns ------- poly : [ra, dec, ...] The corners of ...
[ "Convert", "a", "string", "that", "describes", "a", "box", "in", "ds9", "format", "into", "a", "polygon", "that", "is", "given", "by", "the", "corners", "of", "the", "box" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/MIMAS.py#L307-L338
[ "def", "box2poly", "(", "line", ")", ":", "words", "=", "re", ".", "split", "(", "'[(\\s,)]'", ",", "line", ")", "ra", "=", "words", "[", "1", "]", "dec", "=", "words", "[", "2", "]", "width", "=", "words", "[", "3", "]", "height", "=", "words"...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
circle2circle
Parse a string that describes a circle in ds9 format. Parameters ---------- line : str A string containing a DS9 region command for a circle. Returns ------- circle : [ra, dec, radius] The center and radius of the circle.
AegeanTools/MIMAS.py
def circle2circle(line): """ Parse a string that describes a circle in ds9 format. Parameters ---------- line : str A string containing a DS9 region command for a circle. Returns ------- circle : [ra, dec, radius] The center and radius of the circle. """ words =...
def circle2circle(line): """ Parse a string that describes a circle in ds9 format. Parameters ---------- line : str A string containing a DS9 region command for a circle. Returns ------- circle : [ra, dec, radius] The center and radius of the circle. """ words =...
[ "Parse", "a", "string", "that", "describes", "a", "circle", "in", "ds9", "format", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/MIMAS.py#L341-L365
[ "def", "circle2circle", "(", "line", ")", ":", "words", "=", "re", ".", "split", "(", "'[(,\\s)]'", ",", "line", ")", "ra", "=", "words", "[", "1", "]", "dec", "=", "words", "[", "2", "]", "radius", "=", "words", "[", "3", "]", "[", ":", "-", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
poly2poly
Parse a string of text containing a DS9 description of a polygon. This function works but is not very robust due to the constraints of healpy. Parameters ---------- line : str A string containing a DS9 region command for a polygon. Returns ------- poly : [ra, dec, ...] The...
AegeanTools/MIMAS.py
def poly2poly(line): """ Parse a string of text containing a DS9 description of a polygon. This function works but is not very robust due to the constraints of healpy. Parameters ---------- line : str A string containing a DS9 region command for a polygon. Returns ------- ...
def poly2poly(line): """ Parse a string of text containing a DS9 description of a polygon. This function works but is not very robust due to the constraints of healpy. Parameters ---------- line : str A string containing a DS9 region command for a polygon. Returns ------- ...
[ "Parse", "a", "string", "of", "text", "containing", "a", "DS9", "description", "of", "a", "polygon", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/MIMAS.py#L368-L397
[ "def", "poly2poly", "(", "line", ")", ":", "words", "=", "re", ".", "split", "(", "'[(\\s,)]'", ",", "line", ")", "ras", "=", "np", ".", "array", "(", "words", "[", "1", ":", ":", "2", "]", ")", "decs", "=", "np", ".", "array", "(", "words", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
reg2mim
Parse a DS9 region file and write a MIMAS region (.mim) file. Parameters ---------- regfile : str DS9 region (.reg) file. mimfile : str MIMAS region (.mim) file. maxdepth : str Depth/resolution of the region file.
AegeanTools/MIMAS.py
def reg2mim(regfile, mimfile, maxdepth): """ Parse a DS9 region file and write a MIMAS region (.mim) file. Parameters ---------- regfile : str DS9 region (.reg) file. mimfile : str MIMAS region (.mim) file. maxdepth : str Depth/resolution of the region file. "...
def reg2mim(regfile, mimfile, maxdepth): """ Parse a DS9 region file and write a MIMAS region (.mim) file. Parameters ---------- regfile : str DS9 region (.reg) file. mimfile : str MIMAS region (.mim) file. maxdepth : str Depth/resolution of the region file. "...
[ "Parse", "a", "DS9", "region", "file", "and", "write", "a", "MIMAS", "region", "(", ".", "mim", ")", "file", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/MIMAS.py#L400-L436
[ "def", "reg2mim", "(", "regfile", ",", "mimfile", ",", "maxdepth", ")", ":", "logging", ".", "info", "(", "\"Reading regions from {0}\"", ".", "format", "(", "regfile", ")", ")", "lines", "=", "(", "l", "for", "l", "in", "open", "(", "regfile", ",", "'...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
combine_regions
Return a region that is the combination of those specified in the container. The container is typically a results instance that comes from argparse. Order of construction is: add regions, subtract regions, add circles, subtract circles, add polygons, subtract polygons. Parameters ---------- co...
AegeanTools/MIMAS.py
def combine_regions(container): """ Return a region that is the combination of those specified in the container. The container is typically a results instance that comes from argparse. Order of construction is: add regions, subtract regions, add circles, subtract circles, add polygons, subtract pol...
def combine_regions(container): """ Return a region that is the combination of those specified in the container. The container is typically a results instance that comes from argparse. Order of construction is: add regions, subtract regions, add circles, subtract circles, add polygons, subtract pol...
[ "Return", "a", "region", "that", "is", "the", "combination", "of", "those", "specified", "in", "the", "container", ".", "The", "container", "is", "typically", "a", "results", "instance", "that", "comes", "from", "argparse", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/MIMAS.py#L439-L511
[ "def", "combine_regions", "(", "container", ")", ":", "# create empty region", "region", "=", "Region", "(", "container", ".", "maxdepth", ")", "# add/rem all the regions from files", "for", "r", "in", "container", ".", "add_region", ":", "logging", ".", "info", "...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
intersect_regions
Construct a region which is the intersection of all regions described in the given list of file names. Parameters ---------- flist : list A list of region filenames. Returns ------- region : :class:`AegeanTools.regions.Region` The intersection of all regions, possibly empty...
AegeanTools/MIMAS.py
def intersect_regions(flist): """ Construct a region which is the intersection of all regions described in the given list of file names. Parameters ---------- flist : list A list of region filenames. Returns ------- region : :class:`AegeanTools.regions.Region` The i...
def intersect_regions(flist): """ Construct a region which is the intersection of all regions described in the given list of file names. Parameters ---------- flist : list A list of region filenames. Returns ------- region : :class:`AegeanTools.regions.Region` The i...
[ "Construct", "a", "region", "which", "is", "the", "intersection", "of", "all", "regions", "described", "in", "the", "given", "list", "of", "file", "names", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/MIMAS.py#L514-L534
[ "def", "intersect_regions", "(", "flist", ")", ":", "if", "len", "(", "flist", ")", "<", "2", ":", "raise", "Exception", "(", "\"Require at least two regions to perform intersection\"", ")", "a", "=", "Region", ".", "load", "(", "flist", "[", "0", "]", ")", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
save_region
Save the given region to a file Parameters ---------- region : :class:`AegeanTools.regions.Region` A region. filename : str Output file name.
AegeanTools/MIMAS.py
def save_region(region, filename): """ Save the given region to a file Parameters ---------- region : :class:`AegeanTools.regions.Region` A region. filename : str Output file name. """ region.save(filename) logging.info("Wrote {0}".format(filename)) return
def save_region(region, filename): """ Save the given region to a file Parameters ---------- region : :class:`AegeanTools.regions.Region` A region. filename : str Output file name. """ region.save(filename) logging.info("Wrote {0}".format(filename)) return
[ "Save", "the", "given", "region", "to", "a", "file" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/MIMAS.py#L537-L551
[ "def", "save_region", "(", "region", ",", "filename", ")", ":", "region", ".", "save", "(", "filename", ")", "logging", ".", "info", "(", "\"Wrote {0}\"", ".", "format", "(", "filename", ")", ")", "return" ]
185d2b4a51b48441a1df747efc9a5271c79399fd
train
save_as_image
Convert a MIMAS region (.mim) file into a image (eg .png) Parameters ---------- region : :class:`AegeanTools.regions.Region` Region of interest. filename : str Output filename.
AegeanTools/MIMAS.py
def save_as_image(region, filename): """ Convert a MIMAS region (.mim) file into a image (eg .png) Parameters ---------- region : :class:`AegeanTools.regions.Region` Region of interest. filename : str Output filename. """ import healpy as hp pixels = list(region.get...
def save_as_image(region, filename): """ Convert a MIMAS region (.mim) file into a image (eg .png) Parameters ---------- region : :class:`AegeanTools.regions.Region` Region of interest. filename : str Output filename. """ import healpy as hp pixels = list(region.get...
[ "Convert", "a", "MIMAS", "region", "(", ".", "mim", ")", "file", "into", "a", "image", "(", "eg", ".", "png", ")" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/MIMAS.py#L554-L573
[ "def", "save_as_image", "(", "region", ",", "filename", ")", ":", "import", "healpy", "as", "hp", "pixels", "=", "list", "(", "region", ".", "get_demoted", "(", ")", ")", "order", "=", "region", ".", "maxdepth", "m", "=", "np", ".", "arange", "(", "h...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
get_pixinfo
Return some pixel information based on the given hdu header pixarea - the area of a single pixel in deg2 pixscale - the side lengths of a pixel (assuming they are square) Parameters ---------- header : HDUHeader or dict FITS header information Returns ------- pixarea : float ...
AegeanTools/fits_image.py
def get_pixinfo(header): """ Return some pixel information based on the given hdu header pixarea - the area of a single pixel in deg2 pixscale - the side lengths of a pixel (assuming they are square) Parameters ---------- header : HDUHeader or dict FITS header information Retur...
def get_pixinfo(header): """ Return some pixel information based on the given hdu header pixarea - the area of a single pixel in deg2 pixscale - the side lengths of a pixel (assuming they are square) Parameters ---------- header : HDUHeader or dict FITS header information Retur...
[ "Return", "some", "pixel", "information", "based", "on", "the", "given", "hdu", "header", "pixarea", "-", "the", "area", "of", "a", "single", "pixel", "in", "deg2", "pixscale", "-", "the", "side", "lengths", "of", "a", "pixel", "(", "assuming", "they", "...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fits_image.py#L20-L60
[ "def", "get_pixinfo", "(", "header", ")", ":", "if", "all", "(", "a", "in", "header", "for", "a", "in", "[", "\"CDELT1\"", ",", "\"CDELT2\"", "]", ")", ":", "pixarea", "=", "abs", "(", "header", "[", "\"CDELT1\"", "]", "*", "header", "[", "\"CDELT2\"...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
get_beam
Create a :class:`AegeanTools.fits_image.Beam` object from a fits header. BPA may be missing but will be assumed to be zero. if BMAJ or BMIN are missing then return None instead of a beam object. Parameters ---------- header : HDUHeader The fits header. Returns ------- beam : ...
AegeanTools/fits_image.py
def get_beam(header): """ Create a :class:`AegeanTools.fits_image.Beam` object from a fits header. BPA may be missing but will be assumed to be zero. if BMAJ or BMIN are missing then return None instead of a beam object. Parameters ---------- header : HDUHeader The fits header. ...
def get_beam(header): """ Create a :class:`AegeanTools.fits_image.Beam` object from a fits header. BPA may be missing but will be assumed to be zero. if BMAJ or BMIN are missing then return None instead of a beam object. Parameters ---------- header : HDUHeader The fits header. ...
[ "Create", "a", ":", "class", ":", "AegeanTools", ".", "fits_image", ".", "Beam", "object", "from", "a", "fits", "header", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fits_image.py#L63-L102
[ "def", "get_beam", "(", "header", ")", ":", "if", "\"BPA\"", "not", "in", "header", ":", "log", ".", "warning", "(", "\"BPA not present in fits header, using 0\"", ")", "bpa", "=", "0", "else", ":", "bpa", "=", "header", "[", "\"BPA\"", "]", "if", "\"BMAJ\...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
fix_aips_header
Search through an image header. If the keywords BMAJ/BMIN/BPA are not set, but there are AIPS history cards, then we can populate the BMAJ/BMIN/BPA. Fix the header if possible, otherwise don't. Either way, don't complain. Parameters ---------- header : HDUHeader Fits header which may or ma...
AegeanTools/fits_image.py
def fix_aips_header(header): """ Search through an image header. If the keywords BMAJ/BMIN/BPA are not set, but there are AIPS history cards, then we can populate the BMAJ/BMIN/BPA. Fix the header if possible, otherwise don't. Either way, don't complain. Parameters ---------- header : HDUH...
def fix_aips_header(header): """ Search through an image header. If the keywords BMAJ/BMIN/BPA are not set, but there are AIPS history cards, then we can populate the BMAJ/BMIN/BPA. Fix the header if possible, otherwise don't. Either way, don't complain. Parameters ---------- header : HDUH...
[ "Search", "through", "an", "image", "header", ".", "If", "the", "keywords", "BMAJ", "/", "BMIN", "/", "BPA", "are", "not", "set", "but", "there", "are", "AIPS", "history", "cards", "then", "we", "can", "populate", "the", "BMAJ", "/", "BMIN", "/", "BPA"...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fits_image.py#L105-L145
[ "def", "fix_aips_header", "(", "header", ")", ":", "if", "'BMAJ'", "in", "header", "and", "'BMIN'", "in", "header", "and", "'BPA'", "in", "header", ":", "# The header already has the required keys so there is nothing to do", "return", "header", "aips_hist", "=", "[", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
FitsImage.set_pixels
Set the image data. Will not work if the new image has a different shape than the current image. Parameters ---------- pixels : numpy.ndarray New image data Returns ------- None
AegeanTools/fits_image.py
def set_pixels(self, pixels): """ Set the image data. Will not work if the new image has a different shape than the current image. Parameters ---------- pixels : numpy.ndarray New image data Returns ------- None """ if...
def set_pixels(self, pixels): """ Set the image data. Will not work if the new image has a different shape than the current image. Parameters ---------- pixels : numpy.ndarray New image data Returns ------- None """ if...
[ "Set", "the", "image", "data", ".", "Will", "not", "work", "if", "the", "new", "image", "has", "a", "different", "shape", "than", "the", "current", "image", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fits_image.py#L235-L254
[ "def", "set_pixels", "(", "self", ",", "pixels", ")", ":", "if", "not", "(", "pixels", ".", "shape", "==", "self", ".", "_pixels", ".", "shape", ")", ":", "raise", "AssertionError", "(", "\"Shape mismatch between pixels supplied {0} and existing image pixels {1}\"",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
FitsImage.get_background_rms
Calculate the rms of the image. The rms is calculated from the interqurtile range (IQR), to reduce bias from source pixels. Returns ------- rms : float The image rms. Notes ----- The rms value is cached after first calculation.
AegeanTools/fits_image.py
def get_background_rms(self): """ Calculate the rms of the image. The rms is calculated from the interqurtile range (IQR), to reduce bias from source pixels. Returns ------- rms : float The image rms. Notes ----- The rms value is cach...
def get_background_rms(self): """ Calculate the rms of the image. The rms is calculated from the interqurtile range (IQR), to reduce bias from source pixels. Returns ------- rms : float The image rms. Notes ----- The rms value is cach...
[ "Calculate", "the", "rms", "of", "the", "image", ".", "The", "rms", "is", "calculated", "from", "the", "interqurtile", "range", "(", "IQR", ")", "to", "reduce", "bias", "from", "source", "pixels", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fits_image.py#L256-L280
[ "def", "get_background_rms", "(", "self", ")", ":", "# TODO: return a proper background RMS ignoring the sources", "# This is an approximate method suggested by PaulH.", "# I have no idea where this magic 1.34896 number comes from...", "if", "self", ".", "_rms", "is", "None", ":", "#...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
FitsImage.pix2sky
Get the sky coordinates for a given image pixel. Parameters ---------- pixel : (float, float) Image coordinates. Returns ------- ra,dec : float Sky coordinates (degrees)
AegeanTools/fits_image.py
def pix2sky(self, pixel): """ Get the sky coordinates for a given image pixel. Parameters ---------- pixel : (float, float) Image coordinates. Returns ------- ra,dec : float Sky coordinates (degrees) """ pixbox = ...
def pix2sky(self, pixel): """ Get the sky coordinates for a given image pixel. Parameters ---------- pixel : (float, float) Image coordinates. Returns ------- ra,dec : float Sky coordinates (degrees) """ pixbox = ...
[ "Get", "the", "sky", "coordinates", "for", "a", "given", "image", "pixel", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fits_image.py#L282-L299
[ "def", "pix2sky", "(", "self", ",", "pixel", ")", ":", "pixbox", "=", "numpy", ".", "array", "(", "[", "pixel", ",", "pixel", "]", ")", "skybox", "=", "self", ".", "wcs", ".", "all_pix2world", "(", "pixbox", ",", "1", ")", "return", "[", "float", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
FitsImage.sky2pix
Get the pixel coordinates for a given sky position (degrees). Parameters ---------- skypos : (float,float) ra,dec position in degrees. Returns ------- x,y : float Pixel coordinates.
AegeanTools/fits_image.py
def sky2pix(self, skypos): """ Get the pixel coordinates for a given sky position (degrees). Parameters ---------- skypos : (float,float) ra,dec position in degrees. Returns ------- x,y : float Pixel coordinates. """ ...
def sky2pix(self, skypos): """ Get the pixel coordinates for a given sky position (degrees). Parameters ---------- skypos : (float,float) ra,dec position in degrees. Returns ------- x,y : float Pixel coordinates. """ ...
[ "Get", "the", "pixel", "coordinates", "for", "a", "given", "sky", "position", "(", "degrees", ")", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fits_image.py#L307-L324
[ "def", "sky2pix", "(", "self", ",", "skypos", ")", ":", "skybox", "=", "[", "skypos", ",", "skypos", "]", "pixbox", "=", "self", ".", "wcs", ".", "all_world2pix", "(", "skybox", ",", "1", ")", "return", "[", "float", "(", "pixbox", "[", "0", "]", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
load_sources
Open a file, read contents, return a list of all the sources in that file. @param filename: @return: list of OutputSource objects
AegeanTools/AeRes.py
def load_sources(filename): """ Open a file, read contents, return a list of all the sources in that file. @param filename: @return: list of OutputSource objects """ catalog = catalogs.table_to_source_list(catalogs.load_table(filename)) logging.info("read {0} sources from {1}".format(len(cat...
def load_sources(filename): """ Open a file, read contents, return a list of all the sources in that file. @param filename: @return: list of OutputSource objects """ catalog = catalogs.table_to_source_list(catalogs.load_table(filename)) logging.info("read {0} sources from {1}".format(len(cat...
[ "Open", "a", "file", "read", "contents", "return", "a", "list", "of", "all", "the", "sources", "in", "that", "file", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/AeRes.py#L19-L27
[ "def", "load_sources", "(", "filename", ")", ":", "catalog", "=", "catalogs", ".", "table_to_source_list", "(", "catalogs", ".", "load_table", "(", "filename", ")", ")", "logging", ".", "info", "(", "\"read {0} sources from {1}\"", ".", "format", "(", "len", "...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
search_beam
Will search the beam info from the HISTORY :param hdulist: :return:
scripts/fix_beam.py
def search_beam(hdulist): """ Will search the beam info from the HISTORY :param hdulist: :return: """ header = hdulist[0].header history = header['HISTORY'] history_str = str(history) #AIPS CLEAN BMAJ= 1.2500E-02 BMIN= 1.2500E-02 BPA= 0.00 if 'BMAJ' in history_str: ...
def search_beam(hdulist): """ Will search the beam info from the HISTORY :param hdulist: :return: """ header = hdulist[0].header history = header['HISTORY'] history_str = str(history) #AIPS CLEAN BMAJ= 1.2500E-02 BMIN= 1.2500E-02 BPA= 0.00 if 'BMAJ' in history_str: ...
[ "Will", "search", "the", "beam", "info", "from", "the", "HISTORY", ":", "param", "hdulist", ":", ":", "return", ":" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/scripts/fix_beam.py#L22-L35
[ "def", "search_beam", "(", "hdulist", ")", ":", "header", "=", "hdulist", "[", "0", "]", ".", "header", "history", "=", "header", "[", "'HISTORY'", "]", "history_str", "=", "str", "(", "history", ")", "#AIPS CLEAN BMAJ= 1.2500E-02 BMIN= 1.2500E-02 BPA= 0.00"...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
fix_shape
Ensure that a>=b for a given source object. If a<b then swap a/b and increment pa by 90. err_a/err_b are also swapped as needed. Parameters ---------- source : object any object with a/b/pa/err_a/err_b properties
AegeanTools/source_finder.py
def fix_shape(source): """ Ensure that a>=b for a given source object. If a<b then swap a/b and increment pa by 90. err_a/err_b are also swapped as needed. Parameters ---------- source : object any object with a/b/pa/err_a/err_b properties """ if source.a < source.b: ...
def fix_shape(source): """ Ensure that a>=b for a given source object. If a<b then swap a/b and increment pa by 90. err_a/err_b are also swapped as needed. Parameters ---------- source : object any object with a/b/pa/err_a/err_b properties """ if source.a < source.b: ...
[ "Ensure", "that", "a", ">", "=", "b", "for", "a", "given", "source", "object", ".", "If", "a<b", "then", "swap", "a", "/", "b", "and", "increment", "pa", "by", "90", ".", "err_a", "/", "err_b", "are", "also", "swapped", "as", "needed", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L1786-L1802
[ "def", "fix_shape", "(", "source", ")", ":", "if", "source", ".", "a", "<", "source", ".", "b", ":", "source", ".", "a", ",", "source", ".", "b", "=", "source", ".", "b", ",", "source", ".", "a", "source", ".", "err_a", ",", "source", ".", "err...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
theta_limit
Angle theta is periodic with period pi. Constrain theta such that -pi/2<theta<=pi/2. Parameters ---------- theta : float Input angle. Returns ------- theta : float Rotate angle.
AegeanTools/source_finder.py
def theta_limit(theta): """ Angle theta is periodic with period pi. Constrain theta such that -pi/2<theta<=pi/2. Parameters ---------- theta : float Input angle. Returns ------- theta : float Rotate angle. """ while theta <= -1 * np.pi / 2: theta += ...
def theta_limit(theta): """ Angle theta is periodic with period pi. Constrain theta such that -pi/2<theta<=pi/2. Parameters ---------- theta : float Input angle. Returns ------- theta : float Rotate angle. """ while theta <= -1 * np.pi / 2: theta += ...
[ "Angle", "theta", "is", "periodic", "with", "period", "pi", ".", "Constrain", "theta", "such", "that", "-", "pi", "/", "2<theta<", "=", "pi", "/", "2", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L1827-L1846
[ "def", "theta_limit", "(", "theta", ")", ":", "while", "theta", "<=", "-", "1", "*", "np", ".", "pi", "/", "2", ":", "theta", "+=", "np", ".", "pi", "while", "theta", ">", "np", ".", "pi", "/", "2", ":", "theta", "-=", "np", ".", "pi", "retur...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
scope2lat
Convert a telescope name into a latitude returns None when the telescope is unknown. Parameters ---------- telescope : str Acronym (name) of telescope, eg MWA. Returns ------- lat : float The latitude of the telescope. Notes ----- These values were taken from w...
AegeanTools/source_finder.py
def scope2lat(telescope): """ Convert a telescope name into a latitude returns None when the telescope is unknown. Parameters ---------- telescope : str Acronym (name) of telescope, eg MWA. Returns ------- lat : float The latitude of the telescope. Notes --...
def scope2lat(telescope): """ Convert a telescope name into a latitude returns None when the telescope is unknown. Parameters ---------- telescope : str Acronym (name) of telescope, eg MWA. Returns ------- lat : float The latitude of the telescope. Notes --...
[ "Convert", "a", "telescope", "name", "into", "a", "latitude", "returns", "None", "when", "the", "telescope", "is", "unknown", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L1849-L1898
[ "def", "scope2lat", "(", "telescope", ")", ":", "scopes", "=", "{", "'MWA'", ":", "-", "26.703319", ",", "\"ATCA\"", ":", "-", "30.3128", ",", "\"VLA\"", ":", "34.0790", ",", "\"LOFAR\"", ":", "52.9088", ",", "\"KAT7\"", ":", "-", "30.721", ",", "\"MEE...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
check_cores
Determine how many cores we are able to use. Return 1 if we are not able to make a queue via pprocess. Parameters ---------- cores : int The number of cores that are requested. Returns ------- cores : int The number of cores available.
AegeanTools/source_finder.py
def check_cores(cores): """ Determine how many cores we are able to use. Return 1 if we are not able to make a queue via pprocess. Parameters ---------- cores : int The number of cores that are requested. Returns ------- cores : int The number of cores available. ...
def check_cores(cores): """ Determine how many cores we are able to use. Return 1 if we are not able to make a queue via pprocess. Parameters ---------- cores : int The number of cores that are requested. Returns ------- cores : int The number of cores available. ...
[ "Determine", "how", "many", "cores", "we", "are", "able", "to", "use", ".", "Return", "1", "if", "we", "are", "not", "able", "to", "make", "a", "queue", "via", "pprocess", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L1901-L1931
[ "def", "check_cores", "(", "cores", ")", ":", "cores", "=", "min", "(", "multiprocessing", ".", "cpu_count", "(", ")", ",", "cores", ")", "if", "six", ".", "PY3", ":", "log", "=", "logging", ".", "getLogger", "(", "\"Aegean\"", ")", "log", ".", "info...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
get_aux_files
Look for and return all the aux files that are associated witht this filename. Will look for: background (_bkg.fits) rms (_rms.fits) mask (.mim) catalogue (_comp.fits) psf map (_psf.fits) will return filenames if they exist, or None where they do not. Parameters --...
AegeanTools/source_finder.py
def get_aux_files(basename): """ Look for and return all the aux files that are associated witht this filename. Will look for: background (_bkg.fits) rms (_rms.fits) mask (.mim) catalogue (_comp.fits) psf map (_psf.fits) will return filenames if they exist, or None ...
def get_aux_files(basename): """ Look for and return all the aux files that are associated witht this filename. Will look for: background (_bkg.fits) rms (_rms.fits) mask (.mim) catalogue (_comp.fits) psf map (_psf.fits) will return filenames if they exist, or None ...
[ "Look", "for", "and", "return", "all", "the", "aux", "files", "that", "are", "associated", "witht", "this", "filename", ".", "Will", "look", "for", ":", "background", "(", "_bkg", ".", "fits", ")", "rms", "(", "_rms", ".", "fits", ")", "mask", "(", "...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L1934-L1966
[ "def", "get_aux_files", "(", "basename", ")", ":", "base", "=", "os", ".", "path", ".", "splitext", "(", "basename", ")", "[", "0", "]", "files", "=", "{", "\"bkg\"", ":", "base", "+", "\"_bkg.fits\"", ",", "\"rms\"", ":", "base", "+", "\"_rms.fits\"",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
SourceFinder._gen_flood_wrap
Generator function. Segment an image into islands and return one island at a time. Needs to work for entire image, and also for components within an island. Parameters ---------- data : 2d-array Image array. rmsimg : 2d-array Noise image. ...
AegeanTools/source_finder.py
def _gen_flood_wrap(self, data, rmsimg, innerclip, outerclip=None, domask=False): """ Generator function. Segment an image into islands and return one island at a time. Needs to work for entire image, and also for components within an island. Parameters ---------- ...
def _gen_flood_wrap(self, data, rmsimg, innerclip, outerclip=None, domask=False): """ Generator function. Segment an image into islands and return one island at a time. Needs to work for entire image, and also for components within an island. Parameters ---------- ...
[ "Generator", "function", ".", "Segment", "an", "image", "into", "islands", "and", "return", "one", "island", "at", "a", "time", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L83-L154
[ "def", "_gen_flood_wrap", "(", "self", ",", "data", ",", "rmsimg", ",", "innerclip", ",", "outerclip", "=", "None", ",", "domask", "=", "False", ")", ":", "if", "outerclip", "is", "None", ":", "outerclip", "=", "innerclip", "# compute SNR image (data has alrea...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
SourceFinder.estimate_lmfit_parinfo
Estimates the number of sources in an island and returns initial parameters for the fit as well as limits on those parameters. Parameters ---------- data : 2d-array (sub) image of flux values. Background should be subtracted. rmsimg : 2d-array Image of 1...
AegeanTools/source_finder.py
def estimate_lmfit_parinfo(self, data, rmsimg, curve, beam, innerclip, outerclip=None, offsets=(0, 0), max_summits=None): """ Estimates the number of sources in an island and returns initial parameters for the fit as well as limits on those parameters. Par...
def estimate_lmfit_parinfo(self, data, rmsimg, curve, beam, innerclip, outerclip=None, offsets=(0, 0), max_summits=None): """ Estimates the number of sources in an island and returns initial parameters for the fit as well as limits on those parameters. Par...
[ "Estimates", "the", "number", "of", "sources", "in", "an", "island", "and", "returns", "initial", "parameters", "for", "the", "fit", "as", "well", "as", "limits", "on", "those", "parameters", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L159-L386
[ "def", "estimate_lmfit_parinfo", "(", "self", ",", "data", ",", "rmsimg", ",", "curve", ",", "beam", ",", "innerclip", ",", "outerclip", "=", "None", ",", "offsets", "=", "(", "0", ",", "0", ")", ",", "max_summits", "=", "None", ")", ":", "debug_on", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
SourceFinder.result_to_components
Convert fitting results into a set of components Parameters ---------- result : lmfit.MinimizerResult The fitting results. model : lmfit.Parameters The model that was fit. island_data : :class:`AegeanTools.models.IslandFittingData` Data abou...
AegeanTools/source_finder.py
def result_to_components(self, result, model, island_data, isflags): """ Convert fitting results into a set of components Parameters ---------- result : lmfit.MinimizerResult The fitting results. model : lmfit.Parameters The model that was fit. ...
def result_to_components(self, result, model, island_data, isflags): """ Convert fitting results into a set of components Parameters ---------- result : lmfit.MinimizerResult The fitting results. model : lmfit.Parameters The model that was fit. ...
[ "Convert", "fitting", "results", "into", "a", "set", "of", "components" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L388-L603
[ "def", "result_to_components", "(", "self", ",", "result", ",", "model", ",", "island_data", ",", "isflags", ")", ":", "global_data", "=", "self", ".", "global_data", "# island data", "isle_num", "=", "island_data", ".", "isle_num", "idata", "=", "island_data", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
SourceFinder.load_globals
Populate the global_data object by loading or calculating the various components Parameters ---------- filename : str or HDUList Main image which source finding is run on hdu_index : int HDU index of the image within the fits file, default is 0 (first) ...
AegeanTools/source_finder.py
def load_globals(self, filename, hdu_index=0, bkgin=None, rmsin=None, beam=None, verb=False, rms=None, bkg=None, cores=1, do_curve=True, mask=None, lat=None, psf=None, blank=False, docov=True, cube_index=None): """ Populate the global_data object by loading or calculating the variou...
def load_globals(self, filename, hdu_index=0, bkgin=None, rmsin=None, beam=None, verb=False, rms=None, bkg=None, cores=1, do_curve=True, mask=None, lat=None, psf=None, blank=False, docov=True, cube_index=None): """ Populate the global_data object by loading or calculating the variou...
[ "Populate", "the", "global_data", "object", "by", "loading", "or", "calculating", "the", "various", "components" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L608-L742
[ "def", "load_globals", "(", "self", ",", "filename", ",", "hdu_index", "=", "0", ",", "bkgin", "=", "None", ",", "rmsin", "=", "None", ",", "beam", "=", "None", ",", "verb", "=", "False", ",", "rms", "=", "None", ",", "bkg", "=", "None", ",", "co...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
SourceFinder.save_background_files
Generate and save the background and RMS maps as FITS files. They are saved in the current directly as aegean-background.fits and aegean-rms.fits. Parameters ---------- image_filename : str or HDUList Input image. hdu_index : int If fits file has more th...
AegeanTools/source_finder.py
def save_background_files(self, image_filename, hdu_index=0, bkgin=None, rmsin=None, beam=None, rms=None, bkg=None, cores=1, outbase=None): """ Generate and save the background and RMS maps as FITS files. They are saved in the current directly as aegean-background.f...
def save_background_files(self, image_filename, hdu_index=0, bkgin=None, rmsin=None, beam=None, rms=None, bkg=None, cores=1, outbase=None): """ Generate and save the background and RMS maps as FITS files. They are saved in the current directly as aegean-background.f...
[ "Generate", "and", "save", "the", "background", "and", "RMS", "maps", "as", "FITS", "files", ".", "They", "are", "saved", "in", "the", "current", "directly", "as", "aegean", "-", "background", ".", "fits", "and", "aegean", "-", "rms", ".", "fits", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L744-L822
[ "def", "save_background_files", "(", "self", ",", "image_filename", ",", "hdu_index", "=", "0", ",", "bkgin", "=", "None", ",", "rmsin", "=", "None", ",", "beam", "=", "None", ",", "rms", "=", "None", ",", "bkg", "=", "None", ",", "cores", "=", "1", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
SourceFinder.save_image
Save the image data. This is probably only useful if the image data has been blanked. Parameters ---------- outname : str Name for the output file.
AegeanTools/source_finder.py
def save_image(self, outname): """ Save the image data. This is probably only useful if the image data has been blanked. Parameters ---------- outname : str Name for the output file. """ hdu = self.global_data.img.hdu hdu.data = self.g...
def save_image(self, outname): """ Save the image data. This is probably only useful if the image data has been blanked. Parameters ---------- outname : str Name for the output file. """ hdu = self.global_data.img.hdu hdu.data = self.g...
[ "Save", "the", "image", "data", ".", "This", "is", "probably", "only", "useful", "if", "the", "image", "data", "has", "been", "blanked", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L824-L843
[ "def", "save_image", "(", "self", ",", "outname", ")", ":", "hdu", "=", "self", ".", "global_data", ".", "img", ".", "hdu", "hdu", ".", "data", "=", "self", ".", "global_data", ".", "img", ".", "_pixels", "hdu", ".", "header", "[", "\"ORIGIN\"", "]",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
SourceFinder._make_bkg_rms
Calculate an rms image and a bkg image. Parameters ---------- mesh_size : int Number of beams per box default = 20 forced_rms : float The rms of the image. If None: calculate the rms level (default). Otherwise assume a constant rms. ...
AegeanTools/source_finder.py
def _make_bkg_rms(self, mesh_size=20, forced_rms=None, forced_bkg=None, cores=None): """ Calculate an rms image and a bkg image. Parameters ---------- mesh_size : int Number of beams per box default = 20 forced_rms : float The rms of the image. ...
def _make_bkg_rms(self, mesh_size=20, forced_rms=None, forced_bkg=None, cores=None): """ Calculate an rms image and a bkg image. Parameters ---------- mesh_size : int Number of beams per box default = 20 forced_rms : float The rms of the image. ...
[ "Calculate", "an", "rms", "image", "and", "a", "bkg", "image", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L845-L956
[ "def", "_make_bkg_rms", "(", "self", ",", "mesh_size", "=", "20", ",", "forced_rms", "=", "None", ",", "forced_bkg", "=", "None", ",", "cores", "=", "None", ")", ":", "if", "(", "forced_rms", "is", "not", "None", ")", ":", "self", ".", "log", ".", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
SourceFinder._estimate_bkg_rms
Estimate the background noise mean and RMS. The mean is estimated as the median of data. The RMS is estimated as the IQR of data / 1.34896. Parameters ---------- xmin, xmax, ymin, ymax : int The bounding region over which the bkg/rms will be calculated. Retu...
AegeanTools/source_finder.py
def _estimate_bkg_rms(self, xmin, xmax, ymin, ymax): """ Estimate the background noise mean and RMS. The mean is estimated as the median of data. The RMS is estimated as the IQR of data / 1.34896. Parameters ---------- xmin, xmax, ymin, ymax : int The...
def _estimate_bkg_rms(self, xmin, xmax, ymin, ymax): """ Estimate the background noise mean and RMS. The mean is estimated as the median of data. The RMS is estimated as the IQR of data / 1.34896. Parameters ---------- xmin, xmax, ymin, ymax : int The...
[ "Estimate", "the", "background", "noise", "mean", "and", "RMS", ".", "The", "mean", "is", "estimated", "as", "the", "median", "of", "data", ".", "The", "RMS", "is", "estimated", "as", "the", "IQR", "of", "data", "/", "1", ".", "34896", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L958-L990
[ "def", "_estimate_bkg_rms", "(", "self", ",", "xmin", ",", "xmax", ",", "ymin", ",", "ymax", ")", ":", "data", "=", "self", ".", "global_data", ".", "data_pix", "[", "ymin", ":", "ymax", ",", "xmin", ":", "xmax", "]", "pixels", "=", "np", ".", "ext...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
SourceFinder._load_aux_image
Load a fits file (bkg/rms/curve) and make sure that it is the same shape as the main image. Parameters ---------- image : :class:`AegeanTools.fits_image.FitsImage` The main image that has already been loaded. auxfile : str or HDUList The auxiliary file t...
AegeanTools/source_finder.py
def _load_aux_image(self, image, auxfile): """ Load a fits file (bkg/rms/curve) and make sure that it is the same shape as the main image. Parameters ---------- image : :class:`AegeanTools.fits_image.FitsImage` The main image that has already been loaded. ...
def _load_aux_image(self, image, auxfile): """ Load a fits file (bkg/rms/curve) and make sure that it is the same shape as the main image. Parameters ---------- image : :class:`AegeanTools.fits_image.FitsImage` The main image that has already been loaded. ...
[ "Load", "a", "fits", "file", "(", "bkg", "/", "rms", "/", "curve", ")", "and", "make", "sure", "that", "it", "is", "the", "same", "shape", "as", "the", "main", "image", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L992-L1015
[ "def", "_load_aux_image", "(", "self", ",", "image", ",", "auxfile", ")", ":", "auximg", "=", "FitsImage", "(", "auxfile", ",", "beam", "=", "self", ".", "global_data", ".", "beam", ")", ".", "get_pixels", "(", ")", "if", "auximg", ".", "shape", "!=", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
SourceFinder._refit_islands
Do island refitting (priorized fitting) on a group of islands. Parameters ---------- group : list A list of components grouped by island. stage : int Refitting stage. outerclip : float Ignored, placed holder for future development. ...
AegeanTools/source_finder.py
def _refit_islands(self, group, stage, outerclip=None, istart=0): """ Do island refitting (priorized fitting) on a group of islands. Parameters ---------- group : list A list of components grouped by island. stage : int Refitting stage. ...
def _refit_islands(self, group, stage, outerclip=None, istart=0): """ Do island refitting (priorized fitting) on a group of islands. Parameters ---------- group : list A list of components grouped by island. stage : int Refitting stage. ...
[ "Do", "island", "refitting", "(", "priorized", "fitting", ")", "on", "a", "group", "of", "islands", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L1020-L1268
[ "def", "_refit_islands", "(", "self", ",", "group", ",", "stage", ",", "outerclip", "=", "None", ",", "istart", "=", "0", ")", ":", "global_data", "=", "self", ".", "global_data", "sources", "=", "[", "]", "data", "=", "global_data", ".", "data_pix", "...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
SourceFinder._fit_island
Take an Island, do all the parameter estimation and fitting. Parameters ---------- island_data : :class:`AegeanTools.models.IslandFittingData` The island to be fit. Returns ------- sources : list The sources that were fit.
AegeanTools/source_finder.py
def _fit_island(self, island_data): """ Take an Island, do all the parameter estimation and fitting. Parameters ---------- island_data : :class:`AegeanTools.models.IslandFittingData` The island to be fit. Returns ------- sources : list ...
def _fit_island(self, island_data): """ Take an Island, do all the parameter estimation and fitting. Parameters ---------- island_data : :class:`AegeanTools.models.IslandFittingData` The island to be fit. Returns ------- sources : list ...
[ "Take", "an", "Island", "do", "all", "the", "parameter", "estimation", "and", "fitting", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L1270-L1370
[ "def", "_fit_island", "(", "self", ",", "island_data", ")", ":", "global_data", "=", "self", ".", "global_data", "# global data", "dcurve", "=", "global_data", ".", "dcurve", "rmsimg", "=", "global_data", ".", "rmsimg", "# island data", "isle_num", "=", "island_...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
SourceFinder._fit_islands
Execute fitting on a list of islands This function just wraps around fit_island, so that when we do multiprocesing a single process will fit multiple islands before returning results. Parameters ---------- islands : list of :class:`AegeanTools.models.IslandFittingData` ...
AegeanTools/source_finder.py
def _fit_islands(self, islands): """ Execute fitting on a list of islands This function just wraps around fit_island, so that when we do multiprocesing a single process will fit multiple islands before returning results. Parameters ---------- islands : list of :...
def _fit_islands(self, islands): """ Execute fitting on a list of islands This function just wraps around fit_island, so that when we do multiprocesing a single process will fit multiple islands before returning results. Parameters ---------- islands : list of :...
[ "Execute", "fitting", "on", "a", "list", "of", "islands", "This", "function", "just", "wraps", "around", "fit_island", "so", "that", "when", "we", "do", "multiprocesing", "a", "single", "process", "will", "fit", "multiple", "islands", "before", "returning", "r...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L1372-L1394
[ "def", "_fit_islands", "(", "self", ",", "islands", ")", ":", "self", ".", "log", ".", "debug", "(", "\"Fitting group of {0} islands\"", ".", "format", "(", "len", "(", "islands", ")", ")", ")", "sources", "=", "[", "]", "for", "island", "in", "islands",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
SourceFinder.find_sources_in_image
Run the Aegean source finder. Parameters ---------- filename : str or HDUList Image filename or HDUList. hdu_index : int The index of the FITS HDU (extension). outfile : str file for printing catalog (NOT a table, just a text file of my own...
AegeanTools/source_finder.py
def find_sources_in_image(self, filename, hdu_index=0, outfile=None, rms=None, bkg=None, max_summits=None, innerclip=5, outerclip=4, cores=None, rmsin=None, bkgin=None, beam=None, doislandflux=False, nopositive=False, nonegative=False, mask=None, lat=None, img...
def find_sources_in_image(self, filename, hdu_index=0, outfile=None, rms=None, bkg=None, max_summits=None, innerclip=5, outerclip=4, cores=None, rmsin=None, bkgin=None, beam=None, doislandflux=False, nopositive=False, nonegative=False, mask=None, lat=None, img...
[ "Run", "the", "Aegean", "source", "finder", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L1396-L1540
[ "def", "find_sources_in_image", "(", "self", ",", "filename", ",", "hdu_index", "=", "0", ",", "outfile", "=", "None", ",", "rms", "=", "None", ",", "bkg", "=", "None", ",", "max_summits", "=", "None", ",", "innerclip", "=", "5", ",", "outerclip", "=",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
SourceFinder.priorized_fit_islands
Take an input catalog, and image, and optional background/noise images fit the flux and ra/dec for each of the given sources, keeping the morphology fixed if doregroup is true the groups will be recreated based on a matching radius/probability. if doregroup is false then the islands of the inpu...
AegeanTools/source_finder.py
def priorized_fit_islands(self, filename, catalogue, hdu_index=0, outfile=None, bkgin=None, rmsin=None, cores=1, rms=None, bkg=None, beam=None, lat=None, imgpsf=None, catpsf=None, stage=3, ratio=None, outerclip=3, doregroup=True, docov=True, cube_index=None): ...
def priorized_fit_islands(self, filename, catalogue, hdu_index=0, outfile=None, bkgin=None, rmsin=None, cores=1, rms=None, bkg=None, beam=None, lat=None, imgpsf=None, catpsf=None, stage=3, ratio=None, outerclip=3, doregroup=True, docov=True, cube_index=None): ...
[ "Take", "an", "input", "catalog", "and", "image", "and", "optional", "background", "/", "noise", "images", "fit", "the", "flux", "and", "ra", "/", "dec", "for", "each", "of", "the", "given", "sources", "keeping", "the", "morphology", "fixed" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L1542-L1782
[ "def", "priorized_fit_islands", "(", "self", ",", "filename", ",", "catalogue", ",", "hdu_index", "=", "0", ",", "outfile", "=", "None", ",", "bkgin", "=", "None", ",", "rmsin", "=", "None", ",", "cores", "=", "1", ",", "rms", "=", "None", ",", "bkg"...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
check_table_formats
Determine whether a list of files are of a recognizable output type. Parameters ---------- files : str A list of file names Returns ------- result : bool True if *all* the file names are supported
AegeanTools/catalogs.py
def check_table_formats(files): """ Determine whether a list of files are of a recognizable output type. Parameters ---------- files : str A list of file names Returns ------- result : bool True if *all* the file names are supported """ cont = True formats =...
def check_table_formats(files): """ Determine whether a list of files are of a recognizable output type. Parameters ---------- files : str A list of file names Returns ------- result : bool True if *all* the file names are supported """ cont = True formats =...
[ "Determine", "whether", "a", "list", "of", "files", "are", "of", "a", "recognizable", "output", "type", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L45-L69
[ "def", "check_table_formats", "(", "files", ")", ":", "cont", "=", "True", "formats", "=", "get_table_formats", "(", ")", "for", "t", "in", "files", ".", "split", "(", "','", ")", ":", "_", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
show_formats
Print a list of all the file formats that are supported for writing. The file formats are determined by their extensions. Returns ------- None
AegeanTools/catalogs.py
def show_formats(): """ Print a list of all the file formats that are supported for writing. The file formats are determined by their extensions. Returns ------- None """ fmts = { "ann": "Kvis annotation", "reg": "DS9 regions file", "fits": "FITS Binary Table", ...
def show_formats(): """ Print a list of all the file formats that are supported for writing. The file formats are determined by their extensions. Returns ------- None """ fmts = { "ann": "Kvis annotation", "reg": "DS9 regions file", "fits": "FITS Binary Table", ...
[ "Print", "a", "list", "of", "all", "the", "file", "formats", "that", "are", "supported", "for", "writing", ".", "The", "file", "formats", "are", "determined", "by", "their", "extensions", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L72-L97
[ "def", "show_formats", "(", ")", ":", "fmts", "=", "{", "\"ann\"", ":", "\"Kvis annotation\"", ",", "\"reg\"", ":", "\"DS9 regions file\"", ",", "\"fits\"", ":", "\"FITS Binary Table\"", ",", "\"csv\"", ":", "\"Comma separated values\"", ",", "\"tab\"", ":", "\"ta...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
update_meta_data
Modify the metadata dictionary. DATE, PROGRAM, and PROGVER are added/modified. Parameters ---------- meta : dict The dictionary to be modified, default = None (empty) Returns ------- An updated dictionary.
AegeanTools/catalogs.py
def update_meta_data(meta=None): """ Modify the metadata dictionary. DATE, PROGRAM, and PROGVER are added/modified. Parameters ---------- meta : dict The dictionary to be modified, default = None (empty) Returns ------- An updated dictionary. """ if meta is None...
def update_meta_data(meta=None): """ Modify the metadata dictionary. DATE, PROGRAM, and PROGVER are added/modified. Parameters ---------- meta : dict The dictionary to be modified, default = None (empty) Returns ------- An updated dictionary. """ if meta is None...
[ "Modify", "the", "metadata", "dictionary", ".", "DATE", "PROGRAM", "and", "PROGVER", "are", "added", "/", "modified", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L121-L142
[ "def", "update_meta_data", "(", "meta", "=", "None", ")", ":", "if", "meta", "is", "None", ":", "meta", "=", "{", "}", "if", "'DATE'", "not", "in", "meta", ":", "meta", "[", "'DATE'", "]", "=", "strftime", "(", "\"%Y-%m-%d %H:%M:%S\"", ",", "gmtime", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
save_catalog
Save a catalogue of sources using filename as a model. Meta data can be written to some file types (fits, votable). Each type of source will be in a separate file: - base_comp.ext :class:`AegeanTools.models.OutputSource` - base_isle.ext :class:`AegeanTools.models.IslandSource` - base_simp.ext :cla...
AegeanTools/catalogs.py
def save_catalog(filename, catalog, meta=None, prefix=None): """ Save a catalogue of sources using filename as a model. Meta data can be written to some file types (fits, votable). Each type of source will be in a separate file: - base_comp.ext :class:`AegeanTools.models.OutputSource` - base_i...
def save_catalog(filename, catalog, meta=None, prefix=None): """ Save a catalogue of sources using filename as a model. Meta data can be written to some file types (fits, votable). Each type of source will be in a separate file: - base_comp.ext :class:`AegeanTools.models.OutputSource` - base_i...
[ "Save", "a", "catalogue", "of", "sources", "using", "filename", "as", "a", "model", ".", "Meta", "data", "can", "be", "written", "to", "some", "file", "types", "(", "fits", "votable", ")", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L145-L194
[ "def", "save_catalog", "(", "filename", ",", "catalog", ",", "meta", "=", "None", ",", "prefix", "=", "None", ")", ":", "ascii_table_formats", "=", "{", "'csv'", ":", "'csv'", ",", "'tab'", ":", "'tab'", ",", "'tex'", ":", "'latex'", ",", "'html'", ":"...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
load_catalog
Load a catalogue and extract the source positions (only) Parameters ---------- filename : str Filename to read. Supported types are csv, tab, tex, vo, vot, and xml. Returns ------- catalogue : list A list of [ (ra, dec), ...]
AegeanTools/catalogs.py
def load_catalog(filename): """ Load a catalogue and extract the source positions (only) Parameters ---------- filename : str Filename to read. Supported types are csv, tab, tex, vo, vot, and xml. Returns ------- catalogue : list A list of [ (ra, dec), ...] """ ...
def load_catalog(filename): """ Load a catalogue and extract the source positions (only) Parameters ---------- filename : str Filename to read. Supported types are csv, tab, tex, vo, vot, and xml. Returns ------- catalogue : list A list of [ (ra, dec), ...] """ ...
[ "Load", "a", "catalogue", "and", "extract", "the", "source", "positions", "(", "only", ")" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L197-L236
[ "def", "load_catalog", "(", "filename", ")", ":", "supported", "=", "get_table_formats", "(", ")", "fmt", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "[", "-", "1", "]", "[", "1", ":", "]", ".", "lower", "(", ")", "# extension sans...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
load_table
Load a table from a given file. Supports csv, tab, tex, vo, vot, xml, fits, and hdf5. Parameters ---------- filename : str File to read Returns ------- table : Table Table of data.
AegeanTools/catalogs.py
def load_table(filename): """ Load a table from a given file. Supports csv, tab, tex, vo, vot, xml, fits, and hdf5. Parameters ---------- filename : str File to read Returns ------- table : Table Table of data. """ supported = get_table_formats() fmt =...
def load_table(filename): """ Load a table from a given file. Supports csv, tab, tex, vo, vot, xml, fits, and hdf5. Parameters ---------- filename : str File to read Returns ------- table : Table Table of data. """ supported = get_table_formats() fmt =...
[ "Load", "a", "table", "from", "a", "given", "file", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L239-L269
[ "def", "load_table", "(", "filename", ")", ":", "supported", "=", "get_table_formats", "(", ")", "fmt", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "[", "-", "1", "]", "[", "1", ":", "]", ".", "lower", "(", ")", "# extension sans '...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
write_table
Write a table to a file. Parameters ---------- table : Table Table to be written filename : str Destination for saving table. Returns ------- None
AegeanTools/catalogs.py
def write_table(table, filename): """ Write a table to a file. Parameters ---------- table : Table Table to be written filename : str Destination for saving table. Returns ------- None """ try: if os.path.exists(filename): os.remove(file...
def write_table(table, filename): """ Write a table to a file. Parameters ---------- table : Table Table to be written filename : str Destination for saving table. Returns ------- None """ try: if os.path.exists(filename): os.remove(file...
[ "Write", "a", "table", "to", "a", "file", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L272-L299
[ "def", "write_table", "(", "table", ",", "filename", ")", ":", "try", ":", "if", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "os", ".", "remove", "(", "filename", ")", "table", ".", "write", "(", "filename", ")", "log", ".", "info"...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
table_to_source_list
Convert a table of data into a list of sources. A single table must have consistent source types given by src_type. src_type should be one of :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools.models.SimpleSource`, or :class:`AegeanTools.models.IslandSource`. Parameters ---------- ...
AegeanTools/catalogs.py
def table_to_source_list(table, src_type=OutputSource): """ Convert a table of data into a list of sources. A single table must have consistent source types given by src_type. src_type should be one of :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools.models.SimpleSource`, or :class:`Ae...
def table_to_source_list(table, src_type=OutputSource): """ Convert a table of data into a list of sources. A single table must have consistent source types given by src_type. src_type should be one of :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools.models.SimpleSource`, or :class:`Ae...
[ "Convert", "a", "table", "of", "data", "into", "a", "list", "of", "sources", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L302-L343
[ "def", "table_to_source_list", "(", "table", ",", "src_type", "=", "OutputSource", ")", ":", "source_list", "=", "[", "]", "if", "table", "is", "None", ":", "return", "source_list", "for", "row", "in", "table", ":", "# Initialise our object", "src", "=", "sr...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
write_catalog
Write a catalog (list of sources) to a file with format determined by extension. Sources must be of type :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools.models.SimpleSource`, or :class:`AegeanTools.models.IslandSource`. Parameters ---------- filename : str Base name for file ...
AegeanTools/catalogs.py
def write_catalog(filename, catalog, fmt=None, meta=None, prefix=None): """ Write a catalog (list of sources) to a file with format determined by extension. Sources must be of type :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools.models.SimpleSource`, or :class:`AegeanTools.models.IslandSo...
def write_catalog(filename, catalog, fmt=None, meta=None, prefix=None): """ Write a catalog (list of sources) to a file with format determined by extension. Sources must be of type :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools.models.SimpleSource`, or :class:`AegeanTools.models.IslandSo...
[ "Write", "a", "catalog", "(", "list", "of", "sources", ")", "to", "a", "file", "with", "format", "determined", "by", "extension", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L346-L440
[ "def", "write_catalog", "(", "filename", ",", "catalog", ",", "fmt", "=", "None", ",", "meta", "=", "None", ",", "prefix", "=", "None", ")", ":", "if", "meta", "is", "None", ":", "meta", "=", "{", "}", "if", "prefix", "is", "None", ":", "pre", "=...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
writeFITSTable
Convert a table into a FITSTable and then write to disk. Parameters ---------- filename : str Filename to write. table : Table Table to write. Returns ------- None Notes ----- Due to a bug in numpy, `int32` and `float32` are converted to `int64` and `float64` ...
AegeanTools/catalogs.py
def writeFITSTable(filename, table): """ Convert a table into a FITSTable and then write to disk. Parameters ---------- filename : str Filename to write. table : Table Table to write. Returns ------- None Notes ----- Due to a bug in numpy, `int32` and ...
def writeFITSTable(filename, table): """ Convert a table into a FITSTable and then write to disk. Parameters ---------- filename : str Filename to write. table : Table Table to write. Returns ------- None Notes ----- Due to a bug in numpy, `int32` and ...
[ "Convert", "a", "table", "into", "a", "FITSTable", "and", "then", "write", "to", "disk", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L443-L488
[ "def", "writeFITSTable", "(", "filename", ",", "table", ")", ":", "def", "FITSTableType", "(", "val", ")", ":", "\"\"\"\n Return the FITSTable type corresponding to each named parameter in obj\n \"\"\"", "if", "isinstance", "(", "val", ",", "bool", ")", ":",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
writeIslandContours
Write an output file in ds9 .reg format that outlines the boundaries of each island. Parameters ---------- filename : str Filename to write. catalog : list List of sources. Only those of type :class:`AegeanTools.models.IslandSource` will have contours drawn. fmt : str Outp...
AegeanTools/catalogs.py
def writeIslandContours(filename, catalog, fmt='reg'): """ Write an output file in ds9 .reg format that outlines the boundaries of each island. Parameters ---------- filename : str Filename to write. catalog : list List of sources. Only those of type :class:`AegeanTools.models....
def writeIslandContours(filename, catalog, fmt='reg'): """ Write an output file in ds9 .reg format that outlines the boundaries of each island. Parameters ---------- filename : str Filename to write. catalog : list List of sources. Only those of type :class:`AegeanTools.models....
[ "Write", "an", "output", "file", "in", "ds9", ".", "reg", "format", "that", "outlines", "the", "boundaries", "of", "each", "island", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L491-L544
[ "def", "writeIslandContours", "(", "filename", ",", "catalog", ",", "fmt", "=", "'reg'", ")", ":", "if", "fmt", "!=", "'reg'", ":", "log", ".", "warning", "(", "\"Format {0} not yet supported\"", ".", "format", "(", "fmt", ")", ")", "log", ".", "warning", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
writeIslandBoxes
Write an output file in ds9 .reg, or kvis .ann format that contains bounding boxes for all the islands. Parameters ---------- filename : str Filename to write. catalog : list List of sources. Only those of type :class:`AegeanTools.models.IslandSource` will have contours drawn. fmt...
AegeanTools/catalogs.py
def writeIslandBoxes(filename, catalog, fmt): """ Write an output file in ds9 .reg, or kvis .ann format that contains bounding boxes for all the islands. Parameters ---------- filename : str Filename to write. catalog : list List of sources. Only those of type :class:`AegeanToo...
def writeIslandBoxes(filename, catalog, fmt): """ Write an output file in ds9 .reg, or kvis .ann format that contains bounding boxes for all the islands. Parameters ---------- filename : str Filename to write. catalog : list List of sources. Only those of type :class:`AegeanToo...
[ "Write", "an", "output", "file", "in", "ds9", ".", "reg", "or", "kvis", ".", "ann", "format", "that", "contains", "bounding", "boxes", "for", "all", "the", "islands", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L547-L596
[ "def", "writeIslandBoxes", "(", "filename", ",", "catalog", ",", "fmt", ")", ":", "if", "fmt", "not", "in", "[", "'reg'", ",", "'ann'", "]", ":", "log", ".", "warning", "(", "\"Format not supported for island boxes{0}\"", ".", "format", "(", "fmt", ")", ")...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
writeAnn
Write an annotation file that can be read by Kvis (.ann) or DS9 (.reg). Uses ra/dec from catalog. Draws ellipses if bmaj/bmin/pa are in catalog. Draws 30" circles otherwise. Only :class:`AegeanTools.models.OutputSource` will appear in the annotation file unless there are none, in which case :class:`Aeg...
AegeanTools/catalogs.py
def writeAnn(filename, catalog, fmt): """ Write an annotation file that can be read by Kvis (.ann) or DS9 (.reg). Uses ra/dec from catalog. Draws ellipses if bmaj/bmin/pa are in catalog. Draws 30" circles otherwise. Only :class:`AegeanTools.models.OutputSource` will appear in the annotation file ...
def writeAnn(filename, catalog, fmt): """ Write an annotation file that can be read by Kvis (.ann) or DS9 (.reg). Uses ra/dec from catalog. Draws ellipses if bmaj/bmin/pa are in catalog. Draws 30" circles otherwise. Only :class:`AegeanTools.models.OutputSource` will appear in the annotation file ...
[ "Write", "an", "annotation", "file", "that", "can", "be", "read", "by", "Kvis", "(", ".", "ann", ")", "or", "DS9", "(", ".", "reg", ")", ".", "Uses", "ra", "/", "dec", "from", "catalog", ".", "Draws", "ellipses", "if", "bmaj", "/", "bmin", "/", "...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L599-L692
[ "def", "writeAnn", "(", "filename", ",", "catalog", ",", "fmt", ")", ":", "if", "fmt", "not", "in", "[", "'reg'", ",", "'ann'", "]", ":", "log", ".", "warning", "(", "\"Format not supported for island boxes{0}\"", ".", "format", "(", "fmt", ")", ")", "re...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
writeDB
Output an sqlite3 database containing one table for each source type Parameters ---------- filename : str Output filename catalog : list List of sources of type :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools.models.SimpleSource`, or :class:`AegeanTools.models.Isl...
AegeanTools/catalogs.py
def writeDB(filename, catalog, meta=None): """ Output an sqlite3 database containing one table for each source type Parameters ---------- filename : str Output filename catalog : list List of sources of type :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools....
def writeDB(filename, catalog, meta=None): """ Output an sqlite3 database containing one table for each source type Parameters ---------- filename : str Output filename catalog : list List of sources of type :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools....
[ "Output", "an", "sqlite3", "database", "containing", "one", "table", "for", "each", "source", "type" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L714-L782
[ "def", "writeDB", "(", "filename", ",", "catalog", ",", "meta", "=", "None", ")", ":", "def", "sqlTypes", "(", "obj", ",", "names", ")", ":", "\"\"\"\n Return the sql type corresponding to each named parameter in obj\n \"\"\"", "types", "=", "[", "]", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
norm_dist
Calculate the normalised distance between two sources. Sources are elliptical Gaussians. The normalised distance is calculated as the GCD distance between the centers, divided by quadrature sum of the radius of each ellipse along a line joining the two ellipses. For ellipses that touch at a single poi...
AegeanTools/cluster.py
def norm_dist(src1, src2): """ Calculate the normalised distance between two sources. Sources are elliptical Gaussians. The normalised distance is calculated as the GCD distance between the centers, divided by quadrature sum of the radius of each ellipse along a line joining the two ellipses. ...
def norm_dist(src1, src2): """ Calculate the normalised distance between two sources. Sources are elliptical Gaussians. The normalised distance is calculated as the GCD distance between the centers, divided by quadrature sum of the radius of each ellipse along a line joining the two ellipses. ...
[ "Calculate", "the", "normalised", "distance", "between", "two", "sources", ".", "Sources", "are", "elliptical", "Gaussians", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/cluster.py#L27-L60
[ "def", "norm_dist", "(", "src1", ",", "src2", ")", ":", "if", "np", ".", "all", "(", "src1", "==", "src2", ")", ":", "return", "0", "dist", "=", "gcd", "(", "src1", ".", "ra", ",", "src1", ".", "dec", ",", "src2", ".", "ra", ",", "src2", ".",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
sky_dist
Great circle distance between two sources. A check is made to determine if the two sources are the same object, in this case the distance is zero. Parameters ---------- src1, src2 : object Two sources to check. Objects must have parameters (ra,dec) in degrees. Returns ------- d...
AegeanTools/cluster.py
def sky_dist(src1, src2): """ Great circle distance between two sources. A check is made to determine if the two sources are the same object, in this case the distance is zero. Parameters ---------- src1, src2 : object Two sources to check. Objects must have parameters (ra,dec) in d...
def sky_dist(src1, src2): """ Great circle distance between two sources. A check is made to determine if the two sources are the same object, in this case the distance is zero. Parameters ---------- src1, src2 : object Two sources to check. Objects must have parameters (ra,dec) in d...
[ "Great", "circle", "distance", "between", "two", "sources", ".", "A", "check", "is", "made", "to", "determine", "if", "the", "two", "sources", "are", "the", "same", "object", "in", "this", "case", "the", "distance", "is", "zero", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/cluster.py#L63-L86
[ "def", "sky_dist", "(", "src1", ",", "src2", ")", ":", "if", "np", ".", "all", "(", "src1", "==", "src2", ")", ":", "return", "0", "return", "gcd", "(", "src1", ".", "ra", ",", "src1", ".", "dec", ",", "src2", ".", "ra", ",", "src2", ".", "de...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
pairwise_ellpitical_binary
Do a pairwise comparison of all sources and determine if they have a normalized distance within eps. Form this into a matrix of shape NxN. Parameters ---------- sources : list A list of sources (objects with parameters: ra,dec,a,b,pa) eps : float Normalised distance constrain...
AegeanTools/cluster.py
def pairwise_ellpitical_binary(sources, eps, far=None): """ Do a pairwise comparison of all sources and determine if they have a normalized distance within eps. Form this into a matrix of shape NxN. Parameters ---------- sources : list A list of sources (objects with parameters: r...
def pairwise_ellpitical_binary(sources, eps, far=None): """ Do a pairwise comparison of all sources and determine if they have a normalized distance within eps. Form this into a matrix of shape NxN. Parameters ---------- sources : list A list of sources (objects with parameters: r...
[ "Do", "a", "pairwise", "comparison", "of", "all", "sources", "and", "determine", "if", "they", "have", "a", "normalized", "distance", "within", "eps", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/cluster.py#L89-L135
[ "def", "pairwise_ellpitical_binary", "(", "sources", ",", "eps", ",", "far", "=", "None", ")", ":", "if", "far", "is", "None", ":", "far", "=", "max", "(", "a", ".", "a", "/", "3600", "for", "a", "in", "sources", ")", "l", "=", "len", "(", "sourc...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
regroup_vectorized
Regroup the islands of a catalog according to their normalised distance. Assumes srccat is recarray-like for efficiency. Return a list of island groups. Parameters ---------- srccat : np.rec.arry or pd.DataFrame Should have the following fields[units]: ra[deg],dec[deg], a[arcsec],b...
AegeanTools/cluster.py
def regroup_vectorized(srccat, eps, far=None, dist=norm_dist): """ Regroup the islands of a catalog according to their normalised distance. Assumes srccat is recarray-like for efficiency. Return a list of island groups. Parameters ---------- srccat : np.rec.arry or pd.DataFrame Sho...
def regroup_vectorized(srccat, eps, far=None, dist=norm_dist): """ Regroup the islands of a catalog according to their normalised distance. Assumes srccat is recarray-like for efficiency. Return a list of island groups. Parameters ---------- srccat : np.rec.arry or pd.DataFrame Sho...
[ "Regroup", "the", "islands", "of", "a", "catalog", "according", "to", "their", "normalised", "distance", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/cluster.py#L138-L206
[ "def", "regroup_vectorized", "(", "srccat", ",", "eps", ",", "far", "=", "None", ",", "dist", "=", "norm_dist", ")", ":", "if", "far", "is", "None", ":", "far", "=", "0.5", "# 10*max(a.a/3600 for a in srccat)", "# most negative declination first", "# XXX: kind='me...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
regroup
Regroup the islands of a catalog according to their normalised distance. Return a list of island groups. Sources have their (island,source) parameters relabeled. Parameters ---------- catalog : str or object Either a filename to read into a source list, or a list of objects with the following ...
AegeanTools/cluster.py
def regroup(catalog, eps, far=None, dist=norm_dist): """ Regroup the islands of a catalog according to their normalised distance. Return a list of island groups. Sources have their (island,source) parameters relabeled. Parameters ---------- catalog : str or object Either a filename to ...
def regroup(catalog, eps, far=None, dist=norm_dist): """ Regroup the islands of a catalog according to their normalised distance. Return a list of island groups. Sources have their (island,source) parameters relabeled. Parameters ---------- catalog : str or object Either a filename to ...
[ "Regroup", "the", "islands", "of", "a", "catalog", "according", "to", "their", "normalised", "distance", ".", "Return", "a", "list", "of", "island", "groups", ".", "Sources", "have", "their", "(", "island", "source", ")", "parameters", "relabeled", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/cluster.py#L209-L278
[ "def", "regroup", "(", "catalog", ",", "eps", ",", "far", "=", "None", ",", "dist", "=", "norm_dist", ")", ":", "if", "isinstance", "(", "catalog", ",", "str", ")", ":", "table", "=", "load_table", "(", "catalog", ")", "srccat", "=", "table_to_source_l...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
load_file_or_hdu
Load a file from disk and return an HDUList If filename is already an HDUList return that instead Parameters ---------- filename : str or HDUList File or HDU to be loaded Returns ------- hdulist : HDUList
AegeanTools/fits_interp.py
def load_file_or_hdu(filename): """ Load a file from disk and return an HDUList If filename is already an HDUList return that instead Parameters ---------- filename : str or HDUList File or HDU to be loaded Returns ------- hdulist : HDUList """ if isinstance(filenam...
def load_file_or_hdu(filename): """ Load a file from disk and return an HDUList If filename is already an HDUList return that instead Parameters ---------- filename : str or HDUList File or HDU to be loaded Returns ------- hdulist : HDUList """ if isinstance(filenam...
[ "Load", "a", "file", "from", "disk", "and", "return", "an", "HDUList", "If", "filename", "is", "already", "an", "HDUList", "return", "that", "instead" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fits_interp.py#L16-L34
[ "def", "load_file_or_hdu", "(", "filename", ")", ":", "if", "isinstance", "(", "filename", ",", "fits", ".", "HDUList", ")", ":", "hdulist", "=", "filename", "else", ":", "hdulist", "=", "fits", ".", "open", "(", "filename", ",", "ignore_missing_end", "=",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
compress
Compress a file using decimation. Parameters ---------- datafile : str or HDUList Input data to be loaded. (HDUList will be modified if passed). factor : int Decimation factor. outfile : str File to be written. Default = None, which means don't write a file. Returns ...
AegeanTools/fits_interp.py
def compress(datafile, factor, outfile=None): """ Compress a file using decimation. Parameters ---------- datafile : str or HDUList Input data to be loaded. (HDUList will be modified if passed). factor : int Decimation factor. outfile : str File to be written. Defa...
def compress(datafile, factor, outfile=None): """ Compress a file using decimation. Parameters ---------- datafile : str or HDUList Input data to be loaded. (HDUList will be modified if passed). factor : int Decimation factor. outfile : str File to be written. Defa...
[ "Compress", "a", "file", "using", "decimation", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fits_interp.py#L37-L121
[ "def", "compress", "(", "datafile", ",", "factor", ",", "outfile", "=", "None", ")", ":", "if", "not", "(", "factor", ">", "0", "and", "isinstance", "(", "factor", ",", "int", ")", ")", ":", "logging", ".", "error", "(", "\"factor must be a positive inte...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
expand
Expand and interpolate the given data file using the given method. Datafile can be a filename or an HDUList It is assumed that the file has been compressed and that there are `BN_?` keywords in the fits header that describe how the compression was done. Parameters ---------- datafile : str or ...
AegeanTools/fits_interp.py
def expand(datafile, outfile=None): """ Expand and interpolate the given data file using the given method. Datafile can be a filename or an HDUList It is assumed that the file has been compressed and that there are `BN_?` keywords in the fits header that describe how the compression was done. ...
def expand(datafile, outfile=None): """ Expand and interpolate the given data file using the given method. Datafile can be a filename or an HDUList It is assumed that the file has been compressed and that there are `BN_?` keywords in the fits header that describe how the compression was done. ...
[ "Expand", "and", "interpolate", "the", "given", "data", "file", "using", "the", "given", "method", ".", "Datafile", "can", "be", "a", "filename", "or", "an", "HDUList" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fits_interp.py#L124-L198
[ "def", "expand", "(", "datafile", ",", "outfile", "=", "None", ")", ":", "hdulist", "=", "load_file_or_hdu", "(", "datafile", ")", "header", "=", "hdulist", "[", "0", "]", ".", "header", "data", "=", "hdulist", "[", "0", "]", ".", "data", "# Check for ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
PostgresKernel.change_autocommit_mode
Strip and make a string case insensitive and ensure it is either 'true' or 'false'. If neither, prompt user for either value. When 'true', return True, and when 'false' return False.
postgres_kernel/kernel.py
def change_autocommit_mode(self, switch): """ Strip and make a string case insensitive and ensure it is either 'true' or 'false'. If neither, prompt user for either value. When 'true', return True, and when 'false' return False. """ parsed_switch = switch.strip().lower()...
def change_autocommit_mode(self, switch): """ Strip and make a string case insensitive and ensure it is either 'true' or 'false'. If neither, prompt user for either value. When 'true', return True, and when 'false' return False. """ parsed_switch = switch.strip().lower()...
[ "Strip", "and", "make", "a", "string", "case", "insensitive", "and", "ensure", "it", "is", "either", "true", "or", "false", "." ]
bgschiller/postgres_kernel
python
https://github.com/bgschiller/postgres_kernel/blob/523c4f3b7057ca165d7c0407fd8cc865c793be30/postgres_kernel/kernel.py#L125-L153
[ "def", "change_autocommit_mode", "(", "self", ",", "switch", ")", ":", "parsed_switch", "=", "switch", ".", "strip", "(", ")", ".", "lower", "(", ")", "if", "not", "parsed_switch", "in", "[", "'true'", ",", "'false'", "]", ":", "self", ".", "send_respons...
523c4f3b7057ca165d7c0407fd8cc865c793be30
train
armor
Returns a string in ASCII Armor format, for the given binary data. The output of this is compatiple with pgcrypto's armor/dearmor functions.
pgcrypto/base.py
def armor(data, versioned=True): """ Returns a string in ASCII Armor format, for the given binary data. The output of this is compatiple with pgcrypto's armor/dearmor functions. """ template = '-----BEGIN PGP MESSAGE-----\n%(headers)s%(body)s\n=%(crc)s\n-----END PGP MESSAGE-----' body = base64.b...
def armor(data, versioned=True): """ Returns a string in ASCII Armor format, for the given binary data. The output of this is compatiple with pgcrypto's armor/dearmor functions. """ template = '-----BEGIN PGP MESSAGE-----\n%(headers)s%(body)s\n=%(crc)s\n-----END PGP MESSAGE-----' body = base64.b...
[ "Returns", "a", "string", "in", "ASCII", "Armor", "format", "for", "the", "given", "binary", "data", ".", "The", "output", "of", "this", "is", "compatiple", "with", "pgcrypto", "s", "armor", "/", "dearmor", "functions", "." ]
dcwatson/django-pgcrypto
python
https://github.com/dcwatson/django-pgcrypto/blob/02108795ec97f80af92ff6800a1c55eb958c3496/pgcrypto/base.py#L33-L46
[ "def", "armor", "(", "data", ",", "versioned", "=", "True", ")", ":", "template", "=", "'-----BEGIN PGP MESSAGE-----\\n%(headers)s%(body)s\\n=%(crc)s\\n-----END PGP MESSAGE-----'", "body", "=", "base64", ".", "b64encode", "(", "data", ")", "# The 24-bit CRC should be in big...
02108795ec97f80af92ff6800a1c55eb958c3496
train
dearmor
Given a string in ASCII Armor format, returns the decoded binary data. If verify=True (the default), the CRC is decoded and checked against that of the decoded data, otherwise it is ignored. If the checksum does not match, a BadChecksumError exception is raised.
pgcrypto/base.py
def dearmor(text, verify=True): """ Given a string in ASCII Armor format, returns the decoded binary data. If verify=True (the default), the CRC is decoded and checked against that of the decoded data, otherwise it is ignored. If the checksum does not match, a BadChecksumError exception is raised. ...
def dearmor(text, verify=True): """ Given a string in ASCII Armor format, returns the decoded binary data. If verify=True (the default), the CRC is decoded and checked against that of the decoded data, otherwise it is ignored. If the checksum does not match, a BadChecksumError exception is raised. ...
[ "Given", "a", "string", "in", "ASCII", "Armor", "format", "returns", "the", "decoded", "binary", "data", ".", "If", "verify", "=", "True", "(", "the", "default", ")", "the", "CRC", "is", "decoded", "and", "checked", "against", "that", "of", "the", "decod...
dcwatson/django-pgcrypto
python
https://github.com/dcwatson/django-pgcrypto/blob/02108795ec97f80af92ff6800a1c55eb958c3496/pgcrypto/base.py#L49-L90
[ "def", "dearmor", "(", "text", ",", "verify", "=", "True", ")", ":", "lines", "=", "text", ".", "strip", "(", ")", ".", "split", "(", "'\\n'", ")", "data_lines", "=", "[", "]", "check_data", "=", "None", "started", "=", "False", "in_body", "=", "Fa...
02108795ec97f80af92ff6800a1c55eb958c3496
train
unpad
Takes the last character of the text, and if it is less than the block_size, assumes the text is padded, and removes any trailing zeros or bytes with the value of the pad character. See http://www.di-mgt.com.au/cryptopad.html for more information (methods 1, 3, and 4).
pgcrypto/base.py
def unpad(text, block_size): """ Takes the last character of the text, and if it is less than the block_size, assumes the text is padded, and removes any trailing zeros or bytes with the value of the pad character. See http://www.di-mgt.com.au/cryptopad.html for more information (methods 1, 3, and 4...
def unpad(text, block_size): """ Takes the last character of the text, and if it is less than the block_size, assumes the text is padded, and removes any trailing zeros or bytes with the value of the pad character. See http://www.di-mgt.com.au/cryptopad.html for more information (methods 1, 3, and 4...
[ "Takes", "the", "last", "character", "of", "the", "text", "and", "if", "it", "is", "less", "than", "the", "block_size", "assumes", "the", "text", "is", "padded", "and", "removes", "any", "trailing", "zeros", "or", "bytes", "with", "the", "value", "of", "...
dcwatson/django-pgcrypto
python
https://github.com/dcwatson/django-pgcrypto/blob/02108795ec97f80af92ff6800a1c55eb958c3496/pgcrypto/base.py#L93-L109
[ "def", "unpad", "(", "text", ",", "block_size", ")", ":", "end", "=", "len", "(", "text", ")", "if", "end", "==", "0", ":", "return", "text", "padch", "=", "ord_safe", "(", "text", "[", "end", "-", "1", "]", ")", "if", "padch", ">", "block_size",...
02108795ec97f80af92ff6800a1c55eb958c3496
train
pad
Given a text string and a block size, pads the text with bytes of the same value as the number of padding bytes. This is the recommended method, and the one used by pgcrypto. See http://www.di-mgt.com.au/cryptopad.html for more information.
pgcrypto/base.py
def pad(text, block_size, zero=False): """ Given a text string and a block size, pads the text with bytes of the same value as the number of padding bytes. This is the recommended method, and the one used by pgcrypto. See http://www.di-mgt.com.au/cryptopad.html for more information. """ num = bl...
def pad(text, block_size, zero=False): """ Given a text string and a block size, pads the text with bytes of the same value as the number of padding bytes. This is the recommended method, and the one used by pgcrypto. See http://www.di-mgt.com.au/cryptopad.html for more information. """ num = bl...
[ "Given", "a", "text", "string", "and", "a", "block", "size", "pads", "the", "text", "with", "bytes", "of", "the", "same", "value", "as", "the", "number", "of", "padding", "bytes", ".", "This", "is", "the", "recommended", "method", "and", "the", "one", ...
dcwatson/django-pgcrypto
python
https://github.com/dcwatson/django-pgcrypto/blob/02108795ec97f80af92ff6800a1c55eb958c3496/pgcrypto/base.py#L112-L120
[ "def", "pad", "(", "text", ",", "block_size", ",", "zero", "=", "False", ")", ":", "num", "=", "block_size", "-", "(", "len", "(", "text", ")", "%", "block_size", ")", "ch", "=", "b'\\0'", "if", "zero", "else", "chr", "(", "num", ")", ".", "encod...
02108795ec97f80af92ff6800a1c55eb958c3496
train
aes_pad_key
AES keys must be either 16, 24, or 32 bytes long. If a key is provided that is not one of these lengths, pad it with zeroes (this is what pgcrypto does).
pgcrypto/base.py
def aes_pad_key(key): """ AES keys must be either 16, 24, or 32 bytes long. If a key is provided that is not one of these lengths, pad it with zeroes (this is what pgcrypto does). """ if len(key) in (16, 24, 32): return key if len(key) < 16: return pad(key, 16, zero=True) eli...
def aes_pad_key(key): """ AES keys must be either 16, 24, or 32 bytes long. If a key is provided that is not one of these lengths, pad it with zeroes (this is what pgcrypto does). """ if len(key) in (16, 24, 32): return key if len(key) < 16: return pad(key, 16, zero=True) eli...
[ "AES", "keys", "must", "be", "either", "16", "24", "or", "32", "bytes", "long", ".", "If", "a", "key", "is", "provided", "that", "is", "not", "one", "of", "these", "lengths", "pad", "it", "with", "zeroes", "(", "this", "is", "what", "pgcrypto", "does...
dcwatson/django-pgcrypto
python
https://github.com/dcwatson/django-pgcrypto/blob/02108795ec97f80af92ff6800a1c55eb958c3496/pgcrypto/base.py#L123-L135
[ "def", "aes_pad_key", "(", "key", ")", ":", "if", "len", "(", "key", ")", "in", "(", "16", ",", "24", ",", "32", ")", ":", "return", "key", "if", "len", "(", "key", ")", "<", "16", ":", "return", "pad", "(", "key", ",", "16", ",", "zero", "...
02108795ec97f80af92ff6800a1c55eb958c3496
train
BaseEncryptedField.deconstruct
Deconstruct the field for Django 1.7+ migrations.
pgcrypto/fields.py
def deconstruct(self): """ Deconstruct the field for Django 1.7+ migrations. """ name, path, args, kwargs = super(BaseEncryptedField, self).deconstruct() kwargs.update({ #'key': self.cipher_key, 'cipher': self.cipher_name, 'charset': self.chars...
def deconstruct(self): """ Deconstruct the field for Django 1.7+ migrations. """ name, path, args, kwargs = super(BaseEncryptedField, self).deconstruct() kwargs.update({ #'key': self.cipher_key, 'cipher': self.cipher_name, 'charset': self.chars...
[ "Deconstruct", "the", "field", "for", "Django", "1", ".", "7", "+", "migrations", "." ]
dcwatson/django-pgcrypto
python
https://github.com/dcwatson/django-pgcrypto/blob/02108795ec97f80af92ff6800a1c55eb958c3496/pgcrypto/fields.py#L47-L59
[ "def", "deconstruct", "(", "self", ")", ":", "name", ",", "path", ",", "args", ",", "kwargs", "=", "super", "(", "BaseEncryptedField", ",", "self", ")", ".", "deconstruct", "(", ")", "kwargs", ".", "update", "(", "{", "#'key': self.cipher_key,", "'cipher'"...
02108795ec97f80af92ff6800a1c55eb958c3496
train
BaseEncryptedField.get_cipher
Return a new Cipher object for each time we want to encrypt/decrypt. This is because pgcrypto expects a zeroed block for IV (initial value), but the IV on the cipher object is cumulatively updated each time encrypt/decrypt is called.
pgcrypto/fields.py
def get_cipher(self): """ Return a new Cipher object for each time we want to encrypt/decrypt. This is because pgcrypto expects a zeroed block for IV (initial value), but the IV on the cipher object is cumulatively updated each time encrypt/decrypt is called. """ return s...
def get_cipher(self): """ Return a new Cipher object for each time we want to encrypt/decrypt. This is because pgcrypto expects a zeroed block for IV (initial value), but the IV on the cipher object is cumulatively updated each time encrypt/decrypt is called. """ return s...
[ "Return", "a", "new", "Cipher", "object", "for", "each", "time", "we", "want", "to", "encrypt", "/", "decrypt", ".", "This", "is", "because", "pgcrypto", "expects", "a", "zeroed", "block", "for", "IV", "(", "initial", "value", ")", "but", "the", "IV", ...
dcwatson/django-pgcrypto
python
https://github.com/dcwatson/django-pgcrypto/blob/02108795ec97f80af92ff6800a1c55eb958c3496/pgcrypto/fields.py#L61-L67
[ "def", "get_cipher", "(", "self", ")", ":", "return", "self", ".", "cipher_class", ".", "new", "(", "self", ".", "cipher_key", ",", "self", ".", "cipher_class", ".", "MODE_CBC", ",", "b'\\0'", "*", "self", ".", "cipher_class", ".", "block_size", ")" ]
02108795ec97f80af92ff6800a1c55eb958c3496
train
find_packages_by_root_package
Better than excluding everything that is not needed, collect only what is needed.
setup.py
def find_packages_by_root_package(where): """Better than excluding everything that is not needed, collect only what is needed. """ root_package = os.path.basename(where) packages = [ "%s.%s" % (root_package, sub_package) for sub_package in find_packages(where)] packages.insert(0...
def find_packages_by_root_package(where): """Better than excluding everything that is not needed, collect only what is needed. """ root_package = os.path.basename(where) packages = [ "%s.%s" % (root_package, sub_package) for sub_package in find_packages(where)] packages.insert(0...
[ "Better", "than", "excluding", "everything", "that", "is", "not", "needed", "collect", "only", "what", "is", "needed", "." ]
click-contrib/click-configfile
python
https://github.com/click-contrib/click-configfile/blob/a616204cb9944125fd5051556f27a7ccef611e22/setup.py#L25-L33
[ "def", "find_packages_by_root_package", "(", "where", ")", ":", "root_package", "=", "os", ".", "path", ".", "basename", "(", "where", ")", "packages", "=", "[", "\"%s.%s\"", "%", "(", "root_package", ",", "sub_package", ")", "for", "sub_package", "in", "fin...
a616204cb9944125fd5051556f27a7ccef611e22