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 | odmrun.load_related | Parse data for related objects. | stdnet/backends/redisb/__init__.py | def load_related(self, meta, fname, data, fields, encoding):
'''Parse data for related objects.'''
field = meta.dfields[fname]
if field in meta.multifields:
fmeta = field.structure_class()._meta
if fmeta.name in ('hashtable', 'zset'):
return ((native... | def load_related(self, meta, fname, data, fields, encoding):
'''Parse data for related objects.'''
field = meta.dfields[fname]
if field in meta.multifields:
fmeta = field.structure_class()._meta
if fmeta.name in ('hashtable', 'zset'):
return ((native... | [
"Parse",
"data",
"for",
"related",
"objects",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L107-L121 | [
"def",
"load_related",
"(",
"self",
",",
"meta",
",",
"fname",
",",
"data",
",",
"fields",
",",
"encoding",
")",
":",
"field",
"=",
"meta",
".",
"dfields",
"[",
"fname",
"]",
"if",
"field",
"in",
"meta",
".",
"multifields",
":",
"fmeta",
"=",
"field"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | RedisQuery._execute_query | Execute the query without fetching data. Returns the number of
elements in the query. | stdnet/backends/redisb/__init__.py | def _execute_query(self):
'''Execute the query without fetching data. Returns the number of
elements in the query.'''
pipe = self.pipe
if not self.card:
if self.meta.ordering:
self.ismember = getattr(self.backend.client, 'zrank')
self.card = get... | def _execute_query(self):
'''Execute the query without fetching data. Returns the number of
elements in the query.'''
pipe = self.pipe
if not self.card:
if self.meta.ordering:
self.ismember = getattr(self.backend.client, 'zrank')
self.card = get... | [
"Execute",
"the",
"query",
"without",
"fetching",
"data",
".",
"Returns",
"the",
"number",
"of",
"elements",
"in",
"the",
"query",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L222-L239 | [
"def",
"_execute_query",
"(",
"self",
")",
":",
"pipe",
"=",
"self",
".",
"pipe",
"if",
"not",
"self",
".",
"card",
":",
"if",
"self",
".",
"meta",
".",
"ordering",
":",
"self",
".",
"ismember",
"=",
"getattr",
"(",
"self",
".",
"backend",
".",
"cl... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | RedisQuery.order | Perform ordering with respect model fields. | stdnet/backends/redisb/__init__.py | def order(self, last):
'''Perform ordering with respect model fields.'''
desc = last.desc
field = last.name
nested = last.nested
nested_args = []
while nested:
meta = nested.model._meta
nested_args.extend((self.backend.basekey(meta), nested... | def order(self, last):
'''Perform ordering with respect model fields.'''
desc = last.desc
field = last.name
nested = last.nested
nested_args = []
while nested:
meta = nested.model._meta
nested_args.extend((self.backend.basekey(meta), nested... | [
"Perform",
"ordering",
"with",
"respect",
"model",
"fields",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L241-L258 | [
"def",
"order",
"(",
"self",
",",
"last",
")",
":",
"desc",
"=",
"last",
".",
"desc",
"field",
"=",
"last",
".",
"name",
"nested",
"=",
"last",
".",
"nested",
"nested_args",
"=",
"[",
"]",
"while",
"nested",
":",
"meta",
"=",
"nested",
".",
"model"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | RedisQuery.related_lua_args | Generator of load_related arguments | stdnet/backends/redisb/__init__.py | def related_lua_args(self):
'''Generator of load_related arguments'''
related = self.queryelem.select_related
if related:
meta = self.meta
for rel in related:
field = meta.dfields[rel]
relmodel = field.relmodel
bk = ... | def related_lua_args(self):
'''Generator of load_related arguments'''
related = self.queryelem.select_related
if related:
meta = self.meta
for rel in related:
field = meta.dfields[rel]
relmodel = field.relmodel
bk = ... | [
"Generator",
"of",
"load_related",
"arguments"
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L346-L363 | [
"def",
"related_lua_args",
"(",
"self",
")",
":",
"related",
"=",
"self",
".",
"queryelem",
".",
"select_related",
"if",
"related",
":",
"meta",
"=",
"self",
".",
"meta",
"for",
"rel",
"in",
"related",
":",
"field",
"=",
"meta",
".",
"dfields",
"[",
"r... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Zset.ipop_range | Remove and return a range from the ordered set by rank (index). | stdnet/backends/redisb/__init__.py | def ipop_range(self, start, stop=None, withscores=True, **options):
'''Remove and return a range from the ordered set by rank (index).'''
return self.backend.execute(
self.client.zpopbyrank(self.id, start, stop,
withscores=withscores, **options),
... | def ipop_range(self, start, stop=None, withscores=True, **options):
'''Remove and return a range from the ordered set by rank (index).'''
return self.backend.execute(
self.client.zpopbyrank(self.id, start, stop,
withscores=withscores, **options),
... | [
"Remove",
"and",
"return",
"a",
"range",
"from",
"the",
"ordered",
"set",
"by",
"rank",
"(",
"index",
")",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L482-L487 | [
"def",
"ipop_range",
"(",
"self",
",",
"start",
",",
"stop",
"=",
"None",
",",
"withscores",
"=",
"True",
",",
"*",
"*",
"options",
")",
":",
"return",
"self",
".",
"backend",
".",
"execute",
"(",
"self",
".",
"client",
".",
"zpopbyrank",
"(",
"self"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Zset.pop_range | Remove and return a range from the ordered set by score. | stdnet/backends/redisb/__init__.py | def pop_range(self, start, stop=None, withscores=True, **options):
'''Remove and return a range from the ordered set by score.'''
return self.backend.execute(
self.client.zpopbyscore(self.id, start, stop,
withscores=withscores, **options),
... | def pop_range(self, start, stop=None, withscores=True, **options):
'''Remove and return a range from the ordered set by score.'''
return self.backend.execute(
self.client.zpopbyscore(self.id, start, stop,
withscores=withscores, **options),
... | [
"Remove",
"and",
"return",
"a",
"range",
"from",
"the",
"ordered",
"set",
"by",
"score",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L489-L494 | [
"def",
"pop_range",
"(",
"self",
",",
"start",
",",
"stop",
"=",
"None",
",",
"withscores",
"=",
"True",
",",
"*",
"*",
"options",
")",
":",
"return",
"self",
".",
"backend",
".",
"execute",
"(",
"self",
".",
"client",
".",
"zpopbyscore",
"(",
"self"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | BackendDataServer.meta | Extract model metadata for lua script stdnet/lib/lua/odm.lua | stdnet/backends/redisb/__init__.py | def meta(self, meta):
'''Extract model metadata for lua script stdnet/lib/lua/odm.lua'''
data = meta.as_dict()
data['namespace'] = self.basekey(meta)
return data | def meta(self, meta):
'''Extract model metadata for lua script stdnet/lib/lua/odm.lua'''
data = meta.as_dict()
data['namespace'] = self.basekey(meta)
return data | [
"Extract",
"model",
"metadata",
"for",
"lua",
"script",
"stdnet",
"/",
"lib",
"/",
"lua",
"/",
"odm",
".",
"lua"
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L755-L759 | [
"def",
"meta",
"(",
"self",
",",
"meta",
")",
":",
"data",
"=",
"meta",
".",
"as_dict",
"(",
")",
"data",
"[",
"'namespace'",
"]",
"=",
"self",
".",
"basekey",
"(",
"meta",
")",
"return",
"data"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | BackendDataServer.execute_session | Execute a session in redis. | stdnet/backends/redisb/__init__.py | def execute_session(self, session_data):
'''Execute a session in redis.'''
pipe = self.client.pipeline()
for sm in session_data: # loop through model sessions
meta = sm.meta
if sm.structures:
self.flush_structure(sm, pipe)
delquery = No... | def execute_session(self, session_data):
'''Execute a session in redis.'''
pipe = self.client.pipeline()
for sm in session_data: # loop through model sessions
meta = sm.meta
if sm.structures:
self.flush_structure(sm, pipe)
delquery = No... | [
"Execute",
"a",
"session",
"in",
"redis",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L776-L814 | [
"def",
"execute_session",
"(",
"self",
",",
"session_data",
")",
":",
"pipe",
"=",
"self",
".",
"client",
".",
"pipeline",
"(",
")",
"for",
"sm",
"in",
"session_data",
":",
"# loop through model sessions\r",
"meta",
"=",
"sm",
".",
"meta",
"if",
"sm",
".",... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | BackendDataServer.flush | Flush all model keys from the database | stdnet/backends/redisb/__init__.py | def flush(self, meta=None):
'''Flush all model keys from the database'''
pattern = self.basekey(meta) if meta else self.namespace
return self.client.delpattern('%s*' % pattern) | def flush(self, meta=None):
'''Flush all model keys from the database'''
pattern = self.basekey(meta) if meta else self.namespace
return self.client.delpattern('%s*' % pattern) | [
"Flush",
"all",
"model",
"keys",
"from",
"the",
"database"
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L850-L853 | [
"def",
"flush",
"(",
"self",
",",
"meta",
"=",
"None",
")",
":",
"pattern",
"=",
"self",
".",
"basekey",
"(",
"meta",
")",
"if",
"meta",
"else",
"self",
".",
"namespace",
"return",
"self",
".",
"client",
".",
"delpattern",
"(",
"'%s*'",
"%",
"pattern... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | GetCovariance | Returns the covariance matrix for a given light curve
segment.
:param array_like kernel_params: A list of kernel parameters \
(white noise amplitude, red noise amplitude, and red noise timescale)
:param array_like time: The time array (*N*)
:param array_like errors: The data error array (*N*)... | everest/gp.py | def GetCovariance(kernel, kernel_params, time, errors):
'''
Returns the covariance matrix for a given light curve
segment.
:param array_like kernel_params: A list of kernel parameters \
(white noise amplitude, red noise amplitude, and red noise timescale)
:param array_like time: The time ... | def GetCovariance(kernel, kernel_params, time, errors):
'''
Returns the covariance matrix for a given light curve
segment.
:param array_like kernel_params: A list of kernel parameters \
(white noise amplitude, red noise amplitude, and red noise timescale)
:param array_like time: The time ... | [
"Returns",
"the",
"covariance",
"matrix",
"for",
"a",
"given",
"light",
"curve",
"segment",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/gp.py#L71-L89 | [
"def",
"GetCovariance",
"(",
"kernel",
",",
"kernel_params",
",",
"time",
",",
"errors",
")",
":",
"# NOTE: We purposefully compute the covariance matrix",
"# *without* the GP white noise term",
"K",
"=",
"np",
".",
"diag",
"(",
"errors",
"**",
"2",
")",
"K",
"+=",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | GetKernelParams | Optimizes the GP by training it on the current de-trended light curve.
Returns the white noise amplitude, red noise amplitude,
and red noise timescale.
:param array_like time: The time array
:param array_like flux: The flux array
:param array_like errors: The flux errors array
:param array_like... | everest/gp.py | def GetKernelParams(time, flux, errors, kernel='Basic', mask=[],
giter=3, gmaxf=200, guess=None):
'''
Optimizes the GP by training it on the current de-trended light curve.
Returns the white noise amplitude, red noise amplitude,
and red noise timescale.
:param array_like time: T... | def GetKernelParams(time, flux, errors, kernel='Basic', mask=[],
giter=3, gmaxf=200, guess=None):
'''
Optimizes the GP by training it on the current de-trended light curve.
Returns the white noise amplitude, red noise amplitude,
and red noise timescale.
:param array_like time: T... | [
"Optimizes",
"the",
"GP",
"by",
"training",
"it",
"on",
"the",
"current",
"de",
"-",
"trended",
"light",
"curve",
".",
"Returns",
"the",
"white",
"noise",
"amplitude",
"red",
"noise",
"amplitude",
"and",
"red",
"noise",
"timescale",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/gp.py#L92-L192 | [
"def",
"GetKernelParams",
"(",
"time",
",",
"flux",
",",
"errors",
",",
"kernel",
"=",
"'Basic'",
",",
"mask",
"=",
"[",
"]",
",",
"giter",
"=",
"3",
",",
"gmaxf",
"=",
"200",
",",
"guess",
"=",
"None",
")",
":",
"log",
".",
"info",
"(",
"\"Optim... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | NegLnLike | Returns the negative log-likelihood function and its gradient. | everest/gp.py | def NegLnLike(x, time, flux, errors, kernel):
'''
Returns the negative log-likelihood function and its gradient.
'''
gp = GP(kernel, x, white=True)
gp.compute(time, errors)
if OLDGEORGE:
nll = -gp.lnlikelihood(flux)
# NOTE: There was a bug on this next line! Used to be
... | def NegLnLike(x, time, flux, errors, kernel):
'''
Returns the negative log-likelihood function and its gradient.
'''
gp = GP(kernel, x, white=True)
gp.compute(time, errors)
if OLDGEORGE:
nll = -gp.lnlikelihood(flux)
# NOTE: There was a bug on this next line! Used to be
... | [
"Returns",
"the",
"negative",
"log",
"-",
"likelihood",
"function",
"and",
"its",
"gradient",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/gp.py#L195-L231 | [
"def",
"NegLnLike",
"(",
"x",
",",
"time",
",",
"flux",
",",
"errors",
",",
"kernel",
")",
":",
"gp",
"=",
"GP",
"(",
"kernel",
",",
"x",
",",
"white",
"=",
"True",
")",
"gp",
".",
"compute",
"(",
"time",
",",
"errors",
")",
"if",
"OLDGEORGE",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | missing_intervals | Given a ``startdate`` and an ``enddate`` dates, evaluate the
date intervals from which data is not available. It return a list of
two-dimensional tuples containing start and end date for the interval.
The list could countain 0,1 or 2 tuples. | stdnet/utils/dates.py | def missing_intervals(startdate, enddate, start, end,
dateconverter=None,
parseinterval=None,
intervals=None):
'''Given a ``startdate`` and an ``enddate`` dates, evaluate the
date intervals from which data is not available. It return a list of
... | def missing_intervals(startdate, enddate, start, end,
dateconverter=None,
parseinterval=None,
intervals=None):
'''Given a ``startdate`` and an ``enddate`` dates, evaluate the
date intervals from which data is not available. It return a list of
... | [
"Given",
"a",
"startdate",
"and",
"an",
"enddate",
"dates",
"evaluate",
"the",
"date",
"intervals",
"from",
"which",
"data",
"is",
"not",
"available",
".",
"It",
"return",
"a",
"list",
"of",
"two",
"-",
"dimensional",
"tuples",
"containing",
"start",
"and",
... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/utils/dates.py#L120-L161 | [
"def",
"missing_intervals",
"(",
"startdate",
",",
"enddate",
",",
"start",
",",
"end",
",",
"dateconverter",
"=",
"None",
",",
"parseinterval",
"=",
"None",
",",
"intervals",
"=",
"None",
")",
":",
"parseinterval",
"=",
"parseinterval",
"or",
"default_parse_i... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | dategenerator | Generates dates between *atrt* and *end*. | stdnet/utils/dates.py | def dategenerator(start, end, step=1, desc=False):
'''Generates dates between *atrt* and *end*.'''
delta = timedelta(abs(step))
end = max(start, end)
if desc:
dt = end
while dt >= start:
yield dt
dt -= delta
else:
dt = start
while dt... | def dategenerator(start, end, step=1, desc=False):
'''Generates dates between *atrt* and *end*.'''
delta = timedelta(abs(step))
end = max(start, end)
if desc:
dt = end
while dt >= start:
yield dt
dt -= delta
else:
dt = start
while dt... | [
"Generates",
"dates",
"between",
"*",
"atrt",
"*",
"and",
"*",
"end",
"*",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/utils/dates.py#L164-L177 | [
"def",
"dategenerator",
"(",
"start",
",",
"end",
",",
"step",
"=",
"1",
",",
"desc",
"=",
"False",
")",
":",
"delta",
"=",
"timedelta",
"(",
"abs",
"(",
"step",
")",
")",
"end",
"=",
"max",
"(",
"start",
",",
"end",
")",
"if",
"desc",
":",
"dt... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | InitLog | A little routine to initialize the logging functionality.
:param str file_name: The name of the file to log to. \
Default :py:obj:`None` (set internally by :py:mod:`everest`)
:param int log_level: The file logging level (0-50). Default 10 (debug)
:param int screen_level: The screen logging level... | everest/utils.py | def InitLog(file_name=None, log_level=logging.DEBUG,
screen_level=logging.CRITICAL, pdb=False):
'''
A little routine to initialize the logging functionality.
:param str file_name: The name of the file to log to. \
Default :py:obj:`None` (set internally by :py:mod:`everest`)
:para... | def InitLog(file_name=None, log_level=logging.DEBUG,
screen_level=logging.CRITICAL, pdb=False):
'''
A little routine to initialize the logging functionality.
:param str file_name: The name of the file to log to. \
Default :py:obj:`None` (set internally by :py:mod:`everest`)
:para... | [
"A",
"little",
"routine",
"to",
"initialize",
"the",
"logging",
"functionality",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/utils.py#L66-L113 | [
"def",
"InitLog",
"(",
"file_name",
"=",
"None",
",",
"log_level",
"=",
"logging",
".",
"DEBUG",
",",
"screen_level",
"=",
"logging",
".",
"CRITICAL",
",",
"pdb",
"=",
"False",
")",
":",
"# Initialize the logging",
"root",
"=",
"logging",
".",
"getLogger",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | ExceptionHook | A custom exception handler that logs errors to file. | everest/utils.py | def ExceptionHook(exctype, value, tb):
'''
A custom exception handler that logs errors to file.
'''
for line in traceback.format_exception_only(exctype, value):
log.error(line.replace('\n', ''))
for line in traceback.format_tb(tb):
log.error(line.replace('\n', ''))
sys.__except... | def ExceptionHook(exctype, value, tb):
'''
A custom exception handler that logs errors to file.
'''
for line in traceback.format_exception_only(exctype, value):
log.error(line.replace('\n', ''))
for line in traceback.format_tb(tb):
log.error(line.replace('\n', ''))
sys.__except... | [
"A",
"custom",
"exception",
"handler",
"that",
"logs",
"errors",
"to",
"file",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/utils.py#L116-L126 | [
"def",
"ExceptionHook",
"(",
"exctype",
",",
"value",
",",
"tb",
")",
":",
"for",
"line",
"in",
"traceback",
".",
"format_exception_only",
"(",
"exctype",
",",
"value",
")",
":",
"log",
".",
"error",
"(",
"line",
".",
"replace",
"(",
"'\\n'",
",",
"''"... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | ExceptionHookPDB | A custom exception handler, with :py:obj:`pdb` post-mortem for debugging. | everest/utils.py | def ExceptionHookPDB(exctype, value, tb):
'''
A custom exception handler, with :py:obj:`pdb` post-mortem for debugging.
'''
for line in traceback.format_exception_only(exctype, value):
log.error(line.replace('\n', ''))
for line in traceback.format_tb(tb):
log.error(line.replace('\n... | def ExceptionHookPDB(exctype, value, tb):
'''
A custom exception handler, with :py:obj:`pdb` post-mortem for debugging.
'''
for line in traceback.format_exception_only(exctype, value):
log.error(line.replace('\n', ''))
for line in traceback.format_tb(tb):
log.error(line.replace('\n... | [
"A",
"custom",
"exception",
"handler",
"with",
":",
"py",
":",
"obj",
":",
"pdb",
"post",
"-",
"mortem",
"for",
"debugging",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/utils.py#L129-L140 | [
"def",
"ExceptionHookPDB",
"(",
"exctype",
",",
"value",
",",
"tb",
")",
":",
"for",
"line",
"in",
"traceback",
".",
"format_exception_only",
"(",
"exctype",
",",
"value",
")",
":",
"log",
".",
"error",
"(",
"line",
".",
"replace",
"(",
"'\\n'",
",",
"... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | sort_like | Sorts the list :py:obj:`l` by comparing :py:obj:`col2` to :py:obj:`col1`.
Specifically, finds the indices :py:obj:`i` such that ``col2[i] = col1``
and returns ``l[i]``. This is useful when comparing the CDPP values of
catalogs generated by different pipelines. The
target IDs are all the same, but won't ... | everest/utils.py | def sort_like(l, col1, col2):
'''
Sorts the list :py:obj:`l` by comparing :py:obj:`col2` to :py:obj:`col1`.
Specifically, finds the indices :py:obj:`i` such that ``col2[i] = col1``
and returns ``l[i]``. This is useful when comparing the CDPP values of
catalogs generated by different pipelines. The
... | def sort_like(l, col1, col2):
'''
Sorts the list :py:obj:`l` by comparing :py:obj:`col2` to :py:obj:`col1`.
Specifically, finds the indices :py:obj:`i` such that ``col2[i] = col1``
and returns ``l[i]``. This is useful when comparing the CDPP values of
catalogs generated by different pipelines. The
... | [
"Sorts",
"the",
"list",
":",
"py",
":",
"obj",
":",
"l",
"by",
"comparing",
":",
"py",
":",
"obj",
":",
"col2",
"to",
":",
"py",
":",
"obj",
":",
"col1",
".",
"Specifically",
"finds",
"the",
"indices",
":",
"py",
":",
"obj",
":",
"i",
"such",
"... | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/utils.py#L159-L183 | [
"def",
"sort_like",
"(",
"l",
",",
"col1",
",",
"col2",
")",
":",
"s",
"=",
"np",
".",
"zeros_like",
"(",
"col1",
")",
"*",
"np",
".",
"nan",
"for",
"i",
",",
"c",
"in",
"enumerate",
"(",
"col1",
")",
":",
"j",
"=",
"np",
".",
"argmax",
"(",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | prange | Progress bar range with `tqdm` | everest/utils.py | def prange(*x):
'''
Progress bar range with `tqdm`
'''
try:
root = logging.getLogger()
if len(root.handlers):
for h in root.handlers:
if (type(h) is logging.StreamHandler) and \
(h.level != logging.CRITICAL):
from ... | def prange(*x):
'''
Progress bar range with `tqdm`
'''
try:
root = logging.getLogger()
if len(root.handlers):
for h in root.handlers:
if (type(h) is logging.StreamHandler) and \
(h.level != logging.CRITICAL):
from ... | [
"Progress",
"bar",
"range",
"with",
"tqdm"
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/utils.py#L237-L256 | [
"def",
"prange",
"(",
"*",
"x",
")",
":",
"try",
":",
"root",
"=",
"logging",
".",
"getLogger",
"(",
")",
"if",
"len",
"(",
"root",
".",
"handlers",
")",
":",
"for",
"h",
"in",
"root",
".",
"handlers",
":",
"if",
"(",
"type",
"(",
"h",
")",
"... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | ColumnTS.front | Return the front pair of the structure | stdnet/apps/columnts/npts.py | def front(self, *fields):
'''Return the front pair of the structure'''
ts = self.irange(0, 0, fields=fields)
if ts:
return ts.start(), ts[0] | def front(self, *fields):
'''Return the front pair of the structure'''
ts = self.irange(0, 0, fields=fields)
if ts:
return ts.start(), ts[0] | [
"Return",
"the",
"front",
"pair",
"of",
"the",
"structure"
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/apps/columnts/npts.py#L19-L23 | [
"def",
"front",
"(",
"self",
",",
"*",
"fields",
")",
":",
"ts",
"=",
"self",
".",
"irange",
"(",
"0",
",",
"0",
",",
"fields",
"=",
"fields",
")",
"if",
"ts",
":",
"return",
"ts",
".",
"start",
"(",
")",
",",
"ts",
"[",
"0",
"]"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | ColumnTS.back | Return the back pair of the structure | stdnet/apps/columnts/npts.py | def back(self, *fields):
'''Return the back pair of the structure'''
ts = self.irange(-1, -1, fields=fields)
if ts:
return ts.end(), ts[0] | def back(self, *fields):
'''Return the back pair of the structure'''
ts = self.irange(-1, -1, fields=fields)
if ts:
return ts.end(), ts[0] | [
"Return",
"the",
"back",
"pair",
"of",
"the",
"structure"
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/apps/columnts/npts.py#L25-L29 | [
"def",
"back",
"(",
"self",
",",
"*",
"fields",
")",
":",
"ts",
"=",
"self",
".",
"irange",
"(",
"-",
"1",
",",
"-",
"1",
",",
"fields",
"=",
"fields",
")",
"if",
"ts",
":",
"return",
"ts",
".",
"end",
"(",
")",
",",
"ts",
"[",
"0",
"]"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | parse_backend | Converts the "backend" into the database connection parameters.
It returns a (scheme, host, params) tuple. | stdnet/backends/__init__.py | def parse_backend(backend):
"""Converts the "backend" into the database connection parameters.
It returns a (scheme, host, params) tuple."""
r = urlparse.urlsplit(backend)
scheme, host = r.scheme, r.netloc
path, query = r.path, r.query
if path and not query:
query, path = path, ''
... | def parse_backend(backend):
"""Converts the "backend" into the database connection parameters.
It returns a (scheme, host, params) tuple."""
r = urlparse.urlsplit(backend)
scheme, host = r.scheme, r.netloc
path, query = r.path, r.query
if path and not query:
query, path = path, ''
... | [
"Converts",
"the",
"backend",
"into",
"the",
"database",
"connection",
"parameters",
".",
"It",
"returns",
"a",
"(",
"scheme",
"host",
"params",
")",
"tuple",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/__init__.py#L470-L488 | [
"def",
"parse_backend",
"(",
"backend",
")",
":",
"r",
"=",
"urlparse",
".",
"urlsplit",
"(",
"backend",
")",
"scheme",
",",
"host",
"=",
"r",
".",
"scheme",
",",
"r",
".",
"netloc",
"path",
",",
"query",
"=",
"r",
".",
"path",
",",
"r",
".",
"qu... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | getdb | get a :class:`BackendDataServer`. | stdnet/backends/__init__.py | def getdb(backend=None, **kwargs):
'''get a :class:`BackendDataServer`.'''
if isinstance(backend, BackendDataServer):
return backend
backend = backend or settings.DEFAULT_BACKEND
if not backend:
return None
scheme, address, params = parse_backend(backend)
params.update(kw... | def getdb(backend=None, **kwargs):
'''get a :class:`BackendDataServer`.'''
if isinstance(backend, BackendDataServer):
return backend
backend = backend or settings.DEFAULT_BACKEND
if not backend:
return None
scheme, address, params = parse_backend(backend)
params.update(kw... | [
"get",
"a",
":",
"class",
":",
"BackendDataServer",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/__init__.py#L499-L510 | [
"def",
"getdb",
"(",
"backend",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"backend",
",",
"BackendDataServer",
")",
":",
"return",
"backend",
"backend",
"=",
"backend",
"or",
"settings",
".",
"DEFAULT_BACKEND",
"if",
"not",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | BackendDataServer.basekey | Calculate the key to access model data.
:parameter meta: a :class:`stdnet.odm.Metaclass`.
:parameter args: optional list of strings to prepend to the basekey.
:rtype: a native string | stdnet/backends/__init__.py | def basekey(self, meta, *args):
"""Calculate the key to access model data.
:parameter meta: a :class:`stdnet.odm.Metaclass`.
:parameter args: optional list of strings to prepend to the basekey.
:rtype: a native string
"""
key = '%s%s' % (self.namespace, meta.modelkey)
postfix = ':'.join... | def basekey(self, meta, *args):
"""Calculate the key to access model data.
:parameter meta: a :class:`stdnet.odm.Metaclass`.
:parameter args: optional list of strings to prepend to the basekey.
:rtype: a native string
"""
key = '%s%s' % (self.namespace, meta.modelkey)
postfix = ':'.join... | [
"Calculate",
"the",
"key",
"to",
"access",
"model",
"data",
".",
":",
"parameter",
"meta",
":",
"a",
":",
"class",
":",
"stdnet",
".",
"odm",
".",
"Metaclass",
".",
":",
"parameter",
"args",
":",
"optional",
"list",
"of",
"strings",
"to",
"prepend",
"t... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/__init__.py#L208-L217 | [
"def",
"basekey",
"(",
"self",
",",
"meta",
",",
"*",
"args",
")",
":",
"key",
"=",
"'%s%s'",
"%",
"(",
"self",
".",
"namespace",
",",
"meta",
".",
"modelkey",
")",
"postfix",
"=",
"':'",
".",
"join",
"(",
"(",
"str",
"(",
"p",
")",
"for",
"p",... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | BackendDataServer.make_objects | Generator of :class:`stdnet.odm.StdModel` instances with data
from database.
:parameter meta: instance of model :class:`stdnet.odm.Metaclass`.
:parameter data: iterator over instances data. | stdnet/backends/__init__.py | def make_objects(self, meta, data, related_fields=None):
'''Generator of :class:`stdnet.odm.StdModel` instances with data
from database.
:parameter meta: instance of model :class:`stdnet.odm.Metaclass`.
:parameter data: iterator over instances data.
'''
make_object = meta.make_object
re... | def make_objects(self, meta, data, related_fields=None):
'''Generator of :class:`stdnet.odm.StdModel` instances with data
from database.
:parameter meta: instance of model :class:`stdnet.odm.Metaclass`.
:parameter data: iterator over instances data.
'''
make_object = meta.make_object
re... | [
"Generator",
"of",
":",
"class",
":",
"stdnet",
".",
"odm",
".",
"StdModel",
"instances",
"with",
"data",
"from",
"database",
".",
":",
"parameter",
"meta",
":",
"instance",
"of",
"model",
":",
"class",
":",
"stdnet",
".",
"odm",
".",
"Metaclass",
".",
... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/__init__.py#L227-L258 | [
"def",
"make_objects",
"(",
"self",
",",
"meta",
",",
"data",
",",
"related_fields",
"=",
"None",
")",
":",
"make_object",
"=",
"meta",
".",
"make_object",
"related_data",
"=",
"[",
"]",
"if",
"related_fields",
":",
"for",
"fname",
",",
"fdata",
"in",
"i... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | BackendDataServer.structure | Create a backend :class:`stdnet.odm.Structure` handler.
:param instance: a :class:`stdnet.odm.Structure`
:param client: Optional client handler. | stdnet/backends/__init__.py | def structure(self, instance, client=None):
'''Create a backend :class:`stdnet.odm.Structure` handler.
:param instance: a :class:`stdnet.odm.Structure`
:param client: Optional client handler.
'''
struct = self.struct_map.get(instance._meta.name)
if struct is None:... | def structure(self, instance, client=None):
'''Create a backend :class:`stdnet.odm.Structure` handler.
:param instance: a :class:`stdnet.odm.Structure`
:param client: Optional client handler.
'''
struct = self.struct_map.get(instance._meta.name)
if struct is None:... | [
"Create",
"a",
"backend",
":",
"class",
":",
"stdnet",
".",
"odm",
".",
"Structure",
"handler",
".",
":",
"param",
"instance",
":",
"a",
":",
"class",
":",
"stdnet",
".",
"odm",
".",
"Structure",
":",
"param",
"client",
":",
"Optional",
"client",
"hand... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/__init__.py#L263-L274 | [
"def",
"structure",
"(",
"self",
",",
"instance",
",",
"client",
"=",
"None",
")",
":",
"struct",
"=",
"self",
".",
"struct_map",
".",
"get",
"(",
"instance",
".",
"_meta",
".",
"name",
")",
"if",
"struct",
"is",
"None",
":",
"raise",
"ModelNotAvailabl... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Search | Why is my target not in the EVEREST database? | everest/user.py | def Search(ID, mission='k2'):
"""Why is my target not in the EVEREST database?"""
# Only K2 supported for now
assert mission == 'k2', "Only the K2 mission is supported for now."
print("Searching for target %d..." % ID)
# First check if it is in the database
season = missions.k2.Season(ID)
i... | def Search(ID, mission='k2'):
"""Why is my target not in the EVEREST database?"""
# Only K2 supported for now
assert mission == 'k2', "Only the K2 mission is supported for now."
print("Searching for target %d..." % ID)
# First check if it is in the database
season = missions.k2.Season(ID)
i... | [
"Why",
"is",
"my",
"target",
"not",
"in",
"the",
"EVEREST",
"database?"
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L61-L135 | [
"def",
"Search",
"(",
"ID",
",",
"mission",
"=",
"'k2'",
")",
":",
"# Only K2 supported for now",
"assert",
"mission",
"==",
"'k2'",
",",
"\"Only the K2 mission is supported for now.\"",
"print",
"(",
"\"Searching for target %d...\"",
"%",
"ID",
")",
"# First check if i... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | DownloadFile | Download a given :py:mod:`everest` file from MAST.
:param str mission: The mission name. Default `k2`
:param str cadence: The light curve cadence. Default `lc`
:param str filename: The name of the file to download. Default \
:py:obj:`None`, in which case the default \
FITS file is ret... | everest/user.py | def DownloadFile(ID, season=None, mission='k2', cadence='lc',
filename=None, clobber=False):
'''
Download a given :py:mod:`everest` file from MAST.
:param str mission: The mission name. Default `k2`
:param str cadence: The light curve cadence. Default `lc`
:param str filename: The ... | def DownloadFile(ID, season=None, mission='k2', cadence='lc',
filename=None, clobber=False):
'''
Download a given :py:mod:`everest` file from MAST.
:param str mission: The mission name. Default `k2`
:param str cadence: The light curve cadence. Default `lc`
:param str filename: The ... | [
"Download",
"a",
"given",
":",
"py",
":",
"mod",
":",
"everest",
"file",
"from",
"MAST",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L137-L228 | [
"def",
"DownloadFile",
"(",
"ID",
",",
"season",
"=",
"None",
",",
"mission",
"=",
"'k2'",
",",
"cadence",
"=",
"'lc'",
",",
"filename",
"=",
"None",
",",
"clobber",
"=",
"False",
")",
":",
"# Get season",
"if",
"season",
"is",
"None",
":",
"season",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | DVS | Show the data validation summary (DVS) for a given target.
:param str mission: The mission name. Default `k2`
:param str cadence: The light curve cadence. Default `lc`
:param bool clobber: If :py:obj:`True`, download and overwrite \
existing files. Default :py:obj:`False` | everest/user.py | def DVS(ID, season=None, mission='k2', clobber=False,
cadence='lc', model='nPLD'):
'''
Show the data validation summary (DVS) for a given target.
:param str mission: The mission name. Default `k2`
:param str cadence: The light curve cadence. Default `lc`
:param bool clobber: If :py:obj:`Tru... | def DVS(ID, season=None, mission='k2', clobber=False,
cadence='lc', model='nPLD'):
'''
Show the data validation summary (DVS) for a given target.
:param str mission: The mission name. Default `k2`
:param str cadence: The light curve cadence. Default `lc`
:param bool clobber: If :py:obj:`Tru... | [
"Show",
"the",
"data",
"validation",
"summary",
"(",
"DVS",
")",
"for",
"a",
"given",
"target",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L231-L275 | [
"def",
"DVS",
"(",
"ID",
",",
"season",
"=",
"None",
",",
"mission",
"=",
"'k2'",
",",
"clobber",
"=",
"False",
",",
"cadence",
"=",
"'lc'",
",",
"model",
"=",
"'nPLD'",
")",
":",
"# Get season",
"if",
"season",
"is",
"None",
":",
"season",
"=",
"g... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Everest.compute | Re-compute the :py:mod:`everest` model for the given
value of :py:obj:`lambda`.
For long cadence `k2` light curves, this should take several
seconds. For short cadence `k2` light curves, it may take a
few minutes. Note that this is a simple wrapper around
:py:func:`everest.Baseca... | everest/user.py | def compute(self):
'''
Re-compute the :py:mod:`everest` model for the given
value of :py:obj:`lambda`.
For long cadence `k2` light curves, this should take several
seconds. For short cadence `k2` light curves, it may take a
few minutes. Note that this is a simple wrapper ... | def compute(self):
'''
Re-compute the :py:mod:`everest` model for the given
value of :py:obj:`lambda`.
For long cadence `k2` light curves, this should take several
seconds. For short cadence `k2` light curves, it may take a
few minutes. Note that this is a simple wrapper ... | [
"Re",
"-",
"compute",
"the",
":",
"py",
":",
"mod",
":",
"everest",
"model",
"for",
"the",
"given",
"value",
"of",
":",
"py",
":",
"obj",
":",
"lambda",
".",
"For",
"long",
"cadence",
"k2",
"light",
"curves",
"this",
"should",
"take",
"several",
"sec... | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L368-L387 | [
"def",
"compute",
"(",
"self",
")",
":",
"# If we're doing iterative PLD, get the normalization",
"if",
"self",
".",
"model_name",
"==",
"'iPLD'",
":",
"self",
".",
"_get_norm",
"(",
")",
"# Compute as usual",
"super",
"(",
"Everest",
",",
"self",
")",
".",
"com... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Everest._get_norm | Computes the PLD flux normalization array.
..note :: `iPLD` model **only**. | everest/user.py | def _get_norm(self):
'''
Computes the PLD flux normalization array.
..note :: `iPLD` model **only**.
'''
log.info('Computing the PLD normalization...')
# Loop over all chunks
mod = [None for b in self.breakpoints]
for b, brkpt in enumerate(self.breakpo... | def _get_norm(self):
'''
Computes the PLD flux normalization array.
..note :: `iPLD` model **only**.
'''
log.info('Computing the PLD normalization...')
# Loop over all chunks
mod = [None for b in self.breakpoints]
for b, brkpt in enumerate(self.breakpo... | [
"Computes",
"the",
"PLD",
"flux",
"normalization",
"array",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L389-L467 | [
"def",
"_get_norm",
"(",
"self",
")",
":",
"log",
".",
"info",
"(",
"'Computing the PLD normalization...'",
")",
"# Loop over all chunks",
"mod",
"=",
"[",
"None",
"for",
"b",
"in",
"self",
".",
"breakpoints",
"]",
"for",
"b",
",",
"brkpt",
"in",
"enumerate"... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Everest.load_fits | Load the FITS file from disk and populate the
class instance with its data. | everest/user.py | def load_fits(self):
'''
Load the FITS file from disk and populate the
class instance with its data.
'''
log.info("Loading FITS file for %d." % (self.ID))
with pyfits.open(self.fitsfile) as f:
# Params and long cadence data
self.loaded = True
... | def load_fits(self):
'''
Load the FITS file from disk and populate the
class instance with its data.
'''
log.info("Loading FITS file for %d." % (self.ID))
with pyfits.open(self.fitsfile) as f:
# Params and long cadence data
self.loaded = True
... | [
"Load",
"the",
"FITS",
"file",
"from",
"disk",
"and",
"populate",
"the",
"class",
"instance",
"with",
"its",
"data",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L469-L621 | [
"def",
"load_fits",
"(",
"self",
")",
":",
"log",
".",
"info",
"(",
"\"Loading FITS file for %d.\"",
"%",
"(",
"self",
".",
"ID",
")",
")",
"with",
"pyfits",
".",
"open",
"(",
"self",
".",
"fitsfile",
")",
"as",
"f",
":",
"# Params and long cadence data",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Everest.plot_aperture | Plot sample postage stamps for the target with the aperture
outline marked, as well as a high-res target image (if available).
:param bool show: Show the plot or return the `(fig, ax)` instance? \
Default :py:obj:`True` | everest/user.py | def plot_aperture(self, show=True):
'''
Plot sample postage stamps for the target with the aperture
outline marked, as well as a high-res target image (if available).
:param bool show: Show the plot or return the `(fig, ax)` instance? \
Default :py:obj:`True`
'''... | def plot_aperture(self, show=True):
'''
Plot sample postage stamps for the target with the aperture
outline marked, as well as a high-res target image (if available).
:param bool show: Show the plot or return the `(fig, ax)` instance? \
Default :py:obj:`True`
'''... | [
"Plot",
"sample",
"postage",
"stamps",
"for",
"the",
"target",
"with",
"the",
"aperture",
"outline",
"marked",
"as",
"well",
"as",
"a",
"high",
"-",
"res",
"target",
"image",
"(",
"if",
"available",
")",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L623-L646 | [
"def",
"plot_aperture",
"(",
"self",
",",
"show",
"=",
"True",
")",
":",
"# Set up the axes",
"fig",
",",
"ax",
"=",
"pl",
".",
"subplots",
"(",
"2",
",",
"2",
",",
"figsize",
"=",
"(",
"6",
",",
"8",
")",
")",
"fig",
".",
"subplots_adjust",
"(",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Everest.plot | Plots the final de-trended light curve.
:param bool show: Show the plot or return the `(fig, ax)` instance? \
Default :py:obj:`True`
:param bool plot_raw: Show the raw light curve? Default :py:obj:`True`
:param bool plot_gp: Show the GP model prediction? \
Default ... | everest/user.py | def plot(self, show=True, plot_raw=True, plot_gp=True,
plot_bad=True, plot_out=True, plot_cbv=True,
simple=False):
'''
Plots the final de-trended light curve.
:param bool show: Show the plot or return the `(fig, ax)` instance? \
Default :py:obj:`True`
... | def plot(self, show=True, plot_raw=True, plot_gp=True,
plot_bad=True, plot_out=True, plot_cbv=True,
simple=False):
'''
Plots the final de-trended light curve.
:param bool show: Show the plot or return the `(fig, ax)` instance? \
Default :py:obj:`True`
... | [
"Plots",
"the",
"final",
"de",
"-",
"trended",
"light",
"curve",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L648-L839 | [
"def",
"plot",
"(",
"self",
",",
"show",
"=",
"True",
",",
"plot_raw",
"=",
"True",
",",
"plot_gp",
"=",
"True",
",",
"plot_bad",
"=",
"True",
",",
"plot_out",
"=",
"True",
",",
"plot_cbv",
"=",
"True",
",",
"simple",
"=",
"False",
")",
":",
"log",... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Everest.dvs | Shows the data validation summary (DVS) for the target. | everest/user.py | def dvs(self):
'''
Shows the data validation summary (DVS) for the target.
'''
DVS(self.ID, season=self.season, mission=self.mission,
model=self.model_name, clobber=self.clobber) | def dvs(self):
'''
Shows the data validation summary (DVS) for the target.
'''
DVS(self.ID, season=self.season, mission=self.mission,
model=self.model_name, clobber=self.clobber) | [
"Shows",
"the",
"data",
"validation",
"summary",
"(",
"DVS",
")",
"for",
"the",
"target",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L841-L848 | [
"def",
"dvs",
"(",
"self",
")",
":",
"DVS",
"(",
"self",
".",
"ID",
",",
"season",
"=",
"self",
".",
"season",
",",
"mission",
"=",
"self",
".",
"mission",
",",
"model",
"=",
"self",
".",
"model_name",
",",
"clobber",
"=",
"self",
".",
"clobber",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Everest.plot_pipeline | Plots the light curve for the target de-trended with a given pipeline.
:param str pipeline: The name of the pipeline (lowercase). Options \
are 'everest2', 'everest1', and other mission-specific \
pipelines. For `K2`, the available pipelines are 'k2sff' \
and 'k2sc'... | everest/user.py | def plot_pipeline(self, pipeline, *args, **kwargs):
'''
Plots the light curve for the target de-trended with a given pipeline.
:param str pipeline: The name of the pipeline (lowercase). Options \
are 'everest2', 'everest1', and other mission-specific \
pipelines. F... | def plot_pipeline(self, pipeline, *args, **kwargs):
'''
Plots the light curve for the target de-trended with a given pipeline.
:param str pipeline: The name of the pipeline (lowercase). Options \
are 'everest2', 'everest1', and other mission-specific \
pipelines. F... | [
"Plots",
"the",
"light",
"curve",
"for",
"the",
"target",
"de",
"-",
"trended",
"with",
"a",
"given",
"pipeline",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L850-L925 | [
"def",
"plot_pipeline",
"(",
"self",
",",
"pipeline",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"pipeline",
"!=",
"'everest2'",
":",
"return",
"getattr",
"(",
"missions",
",",
"self",
".",
"mission",
")",
".",
"pipelines",
".",
"plot",... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Everest.get_pipeline | Returns the `time` and `flux` arrays for the target obtained by a given
pipeline.
Options :py:obj:`args` and :py:obj:`kwargs` are passed directly to
the :py:func:`pipelines.get` function of the mission. | everest/user.py | def get_pipeline(self, *args, **kwargs):
'''
Returns the `time` and `flux` arrays for the target obtained by a given
pipeline.
Options :py:obj:`args` and :py:obj:`kwargs` are passed directly to
the :py:func:`pipelines.get` function of the mission.
'''
return ge... | def get_pipeline(self, *args, **kwargs):
'''
Returns the `time` and `flux` arrays for the target obtained by a given
pipeline.
Options :py:obj:`args` and :py:obj:`kwargs` are passed directly to
the :py:func:`pipelines.get` function of the mission.
'''
return ge... | [
"Returns",
"the",
"time",
"and",
"flux",
"arrays",
"for",
"the",
"target",
"obtained",
"by",
"a",
"given",
"pipeline",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L927-L938 | [
"def",
"get_pipeline",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"getattr",
"(",
"missions",
",",
"self",
".",
"mission",
")",
".",
"pipelines",
".",
"get",
"(",
"self",
".",
"ID",
",",
"*",
"args",
",",
"*",
"*"... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Everest.mask_planet | Mask all of the transits/eclipses of a given planet/EB. After calling
this method, you must re-compute the model by calling
:py:meth:`compute` in order for the mask to take effect.
:param float t0: The time of first transit (same units as light curve)
:param float period: The period of ... | everest/user.py | def mask_planet(self, t0, period, dur=0.2):
'''
Mask all of the transits/eclipses of a given planet/EB. After calling
this method, you must re-compute the model by calling
:py:meth:`compute` in order for the mask to take effect.
:param float t0: The time of first transit (same u... | def mask_planet(self, t0, period, dur=0.2):
'''
Mask all of the transits/eclipses of a given planet/EB. After calling
this method, you must re-compute the model by calling
:py:meth:`compute` in order for the mask to take effect.
:param float t0: The time of first transit (same u... | [
"Mask",
"all",
"of",
"the",
"transits",
"/",
"eclipses",
"of",
"a",
"given",
"planet",
"/",
"EB",
".",
"After",
"calling",
"this",
"method",
"you",
"must",
"re",
"-",
"compute",
"the",
"model",
"by",
"calling",
":",
"py",
":",
"meth",
":",
"compute",
... | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L940-L957 | [
"def",
"mask_planet",
"(",
"self",
",",
"t0",
",",
"period",
",",
"dur",
"=",
"0.2",
")",
":",
"mask",
"=",
"[",
"]",
"t0",
"+=",
"np",
".",
"ceil",
"(",
"(",
"self",
".",
"time",
"[",
"0",
"]",
"-",
"dur",
"-",
"t0",
")",
"/",
"period",
")... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Everest._plot_weights | .. warning:: Untested! | everest/user.py | def _plot_weights(self, show=True):
'''
.. warning:: Untested!
'''
# Set up the axes
fig = pl.figure(figsize=(12, 12))
fig.subplots_adjust(top=0.95, bottom=0.025, left=0.1, right=0.92)
fig.canvas.set_window_title(
'%s %d' % (self._mission.IDSTRING, s... | def _plot_weights(self, show=True):
'''
.. warning:: Untested!
'''
# Set up the axes
fig = pl.figure(figsize=(12, 12))
fig.subplots_adjust(top=0.95, bottom=0.025, left=0.1, right=0.92)
fig.canvas.set_window_title(
'%s %d' % (self._mission.IDSTRING, s... | [
"..",
"warning",
"::",
"Untested!"
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L959-L1139 | [
"def",
"_plot_weights",
"(",
"self",
",",
"show",
"=",
"True",
")",
":",
"# Set up the axes",
"fig",
"=",
"pl",
".",
"figure",
"(",
"figsize",
"=",
"(",
"12",
",",
"12",
")",
")",
"fig",
".",
"subplots_adjust",
"(",
"top",
"=",
"0.95",
",",
"bottom",... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Everest._save_npz | Saves all of the de-trending information to disk in an `npz` file | everest/user.py | def _save_npz(self):
'''
Saves all of the de-trending information to disk in an `npz` file
'''
# Save the data
d = dict(self.__dict__)
d.pop('_weights', None)
d.pop('_A', None)
d.pop('_B', None)
d.pop('_f', None)
d.pop('_mK', None)
... | def _save_npz(self):
'''
Saves all of the de-trending information to disk in an `npz` file
'''
# Save the data
d = dict(self.__dict__)
d.pop('_weights', None)
d.pop('_A', None)
d.pop('_B', None)
d.pop('_f', None)
d.pop('_mK', None)
... | [
"Saves",
"all",
"of",
"the",
"de",
"-",
"trending",
"information",
"to",
"disk",
"in",
"an",
"npz",
"file"
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L1298-L1317 | [
"def",
"_save_npz",
"(",
"self",
")",
":",
"# Save the data",
"d",
"=",
"dict",
"(",
"self",
".",
"__dict__",
")",
"d",
".",
"pop",
"(",
"'_weights'",
",",
"None",
")",
"d",
".",
"pop",
"(",
"'_A'",
",",
"None",
")",
"d",
".",
"pop",
"(",
"'_B'",... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Everest.optimize | Runs :py:obj:`pPLD` on the target in an attempt to further optimize the
values of the PLD priors. See :py:class:`everest.detrender.pPLD`. | everest/user.py | def optimize(self, piter=3, pmaxf=300, ppert=0.1):
'''
Runs :py:obj:`pPLD` on the target in an attempt to further optimize the
values of the PLD priors. See :py:class:`everest.detrender.pPLD`.
'''
self._save_npz()
optimized = pPLD(self.ID, piter=piter, pmaxf=pmaxf,
... | def optimize(self, piter=3, pmaxf=300, ppert=0.1):
'''
Runs :py:obj:`pPLD` on the target in an attempt to further optimize the
values of the PLD priors. See :py:class:`everest.detrender.pPLD`.
'''
self._save_npz()
optimized = pPLD(self.ID, piter=piter, pmaxf=pmaxf,
... | [
"Runs",
":",
"py",
":",
"obj",
":",
"pPLD",
"on",
"the",
"target",
"in",
"an",
"attempt",
"to",
"further",
"optimize",
"the",
"values",
"of",
"the",
"PLD",
"priors",
".",
"See",
":",
"py",
":",
"class",
":",
"everest",
".",
"detrender",
".",
"pPLD",
... | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L1319-L1330 | [
"def",
"optimize",
"(",
"self",
",",
"piter",
"=",
"3",
",",
"pmaxf",
"=",
"300",
",",
"ppert",
"=",
"0.1",
")",
":",
"self",
".",
"_save_npz",
"(",
")",
"optimized",
"=",
"pPLD",
"(",
"self",
".",
"ID",
",",
"piter",
"=",
"piter",
",",
"pmaxf",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Everest.plot_folded | Plot the light curve folded on a given `period` and centered at `t0`.
When plotting folded transits, please mask them using
:py:meth:`mask_planet` and re-compute the model using
:py:meth:`compute`.
:param float t0: The time at which to center the plot \
(same units as lig... | everest/user.py | def plot_folded(self, t0, period, dur=0.2):
'''
Plot the light curve folded on a given `period` and centered at `t0`.
When plotting folded transits, please mask them using
:py:meth:`mask_planet` and re-compute the model using
:py:meth:`compute`.
:param float t0: The time... | def plot_folded(self, t0, period, dur=0.2):
'''
Plot the light curve folded on a given `period` and centered at `t0`.
When plotting folded transits, please mask them using
:py:meth:`mask_planet` and re-compute the model using
:py:meth:`compute`.
:param float t0: The time... | [
"Plot",
"the",
"light",
"curve",
"folded",
"on",
"a",
"given",
"period",
"and",
"centered",
"at",
"t0",
".",
"When",
"plotting",
"folded",
"transits",
"please",
"mask",
"them",
"using",
":",
"py",
":",
"meth",
":",
"mask_planet",
"and",
"re",
"-",
"compu... | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L1332-L1383 | [
"def",
"plot_folded",
"(",
"self",
",",
"t0",
",",
"period",
",",
"dur",
"=",
"0.2",
")",
":",
"# Mask the planet",
"self",
".",
"mask_planet",
"(",
"t0",
",",
"period",
",",
"dur",
")",
"# Whiten",
"gp",
"=",
"GP",
"(",
"self",
".",
"kernel",
",",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Everest.plot_transit_model | Plot the light curve de-trended with a join instrumental + transit
model with the best fit transit model overlaid. The transit model
should be specified using the :py:obj:`transit_model` attribute
and should be an instance or list of instances of
:py:class:`everest.transit.TransitModel`.... | everest/user.py | def plot_transit_model(self, show=True, fold=None, ax=None):
'''
Plot the light curve de-trended with a join instrumental + transit
model with the best fit transit model overlaid. The transit model
should be specified using the :py:obj:`transit_model` attribute
and should be an i... | def plot_transit_model(self, show=True, fold=None, ax=None):
'''
Plot the light curve de-trended with a join instrumental + transit
model with the best fit transit model overlaid. The transit model
should be specified using the :py:obj:`transit_model` attribute
and should be an i... | [
"Plot",
"the",
"light",
"curve",
"de",
"-",
"trended",
"with",
"a",
"join",
"instrumental",
"+",
"transit",
"model",
"with",
"the",
"best",
"fit",
"transit",
"model",
"overlaid",
".",
"The",
"transit",
"model",
"should",
"be",
"specified",
"using",
"the",
... | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L1385-L1549 | [
"def",
"plot_transit_model",
"(",
"self",
",",
"show",
"=",
"True",
",",
"fold",
"=",
"None",
",",
"ax",
"=",
"None",
")",
":",
"if",
"self",
".",
"transit_model",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"No transit model provided!\"",
")",
"if",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Interpolate | Masks certain elements in the array `y` and linearly
interpolates over them, returning an array `y'` of the
same length.
:param array_like time: The time array
:param array_like mask: The indices to be interpolated over
:param array_like y: The dependent array | everest/mathutils.py | def Interpolate(time, mask, y):
'''
Masks certain elements in the array `y` and linearly
interpolates over them, returning an array `y'` of the
same length.
:param array_like time: The time array
:param array_like mask: The indices to be interpolated over
:param array_like y: The dependent ... | def Interpolate(time, mask, y):
'''
Masks certain elements in the array `y` and linearly
interpolates over them, returning an array `y'` of the
same length.
:param array_like time: The time array
:param array_like mask: The indices to be interpolated over
:param array_like y: The dependent ... | [
"Masks",
"certain",
"elements",
"in",
"the",
"array",
"y",
"and",
"linearly",
"interpolates",
"over",
"them",
"returning",
"an",
"array",
"y",
"of",
"the",
"same",
"length",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/mathutils.py#L21-L44 | [
"def",
"Interpolate",
"(",
"time",
",",
"mask",
",",
"y",
")",
":",
"# Ensure `y` doesn't get modified in place",
"yy",
"=",
"np",
".",
"array",
"(",
"y",
")",
"t_",
"=",
"np",
".",
"delete",
"(",
"time",
",",
"mask",
")",
"y_",
"=",
"np",
".",
"dele... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Chunks | Returns a generator of consecutive `n`-sized chunks of list `l`.
If `all` is `True`, returns **all** `n`-sized chunks in `l`
by iterating over the starting point. | everest/mathutils.py | def Chunks(l, n, all=False):
'''
Returns a generator of consecutive `n`-sized chunks of list `l`.
If `all` is `True`, returns **all** `n`-sized chunks in `l`
by iterating over the starting point.
'''
if all:
jarr = range(0, n - 1)
else:
jarr = [0]
for j in jarr:
... | def Chunks(l, n, all=False):
'''
Returns a generator of consecutive `n`-sized chunks of list `l`.
If `all` is `True`, returns **all** `n`-sized chunks in `l`
by iterating over the starting point.
'''
if all:
jarr = range(0, n - 1)
else:
jarr = [0]
for j in jarr:
... | [
"Returns",
"a",
"generator",
"of",
"consecutive",
"n",
"-",
"sized",
"chunks",
"of",
"list",
"l",
".",
"If",
"all",
"is",
"True",
"returns",
"**",
"all",
"**",
"n",
"-",
"sized",
"chunks",
"in",
"l",
"by",
"iterating",
"over",
"the",
"starting",
"point... | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/mathutils.py#L58-L78 | [
"def",
"Chunks",
"(",
"l",
",",
"n",
",",
"all",
"=",
"False",
")",
":",
"if",
"all",
":",
"jarr",
"=",
"range",
"(",
"0",
",",
"n",
"-",
"1",
")",
"else",
":",
"jarr",
"=",
"[",
"0",
"]",
"for",
"j",
"in",
"jarr",
":",
"for",
"i",
"in",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Smooth | Smooth data by convolving on a given timescale.
:param ndarray x: The data array
:param int window_len: The size of the smoothing window. Default `100`
:param str window: The window type. Default `hanning` | everest/mathutils.py | def Smooth(x, window_len=100, window='hanning'):
'''
Smooth data by convolving on a given timescale.
:param ndarray x: The data array
:param int window_len: The size of the smoothing window. Default `100`
:param str window: The window type. Default `hanning`
'''
if window_len == 0:
... | def Smooth(x, window_len=100, window='hanning'):
'''
Smooth data by convolving on a given timescale.
:param ndarray x: The data array
:param int window_len: The size of the smoothing window. Default `100`
:param str window: The window type. Default `hanning`
'''
if window_len == 0:
... | [
"Smooth",
"data",
"by",
"convolving",
"on",
"a",
"given",
"timescale",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/mathutils.py#L81-L101 | [
"def",
"Smooth",
"(",
"x",
",",
"window_len",
"=",
"100",
",",
"window",
"=",
"'hanning'",
")",
":",
"if",
"window_len",
"==",
"0",
":",
"return",
"np",
".",
"zeros_like",
"(",
"x",
")",
"s",
"=",
"np",
".",
"r_",
"[",
"2",
"*",
"x",
"[",
"0",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Scatter | Return the scatter in ppm based on the median running standard deviation
for a window size of :py:obj:`win` = 13 cadences (for K2, this
is ~6.5 hours, as in VJ14).
:param ndarray y: The array whose CDPP is to be computed
:param int win: The window size in cadences. Default `13`
:param bool remove_o... | everest/mathutils.py | def Scatter(y, win=13, remove_outliers=False):
'''
Return the scatter in ppm based on the median running standard deviation
for a window size of :py:obj:`win` = 13 cadences (for K2, this
is ~6.5 hours, as in VJ14).
:param ndarray y: The array whose CDPP is to be computed
:param int win: The win... | def Scatter(y, win=13, remove_outliers=False):
'''
Return the scatter in ppm based on the median running standard deviation
for a window size of :py:obj:`win` = 13 cadences (for K2, this
is ~6.5 hours, as in VJ14).
:param ndarray y: The array whose CDPP is to be computed
:param int win: The win... | [
"Return",
"the",
"scatter",
"in",
"ppm",
"based",
"on",
"the",
"median",
"running",
"standard",
"deviation",
"for",
"a",
"window",
"size",
"of",
":",
"py",
":",
"obj",
":",
"win",
"=",
"13",
"cadences",
"(",
"for",
"K2",
"this",
"is",
"~6",
".",
"5",... | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/mathutils.py#L104-L136 | [
"def",
"Scatter",
"(",
"y",
",",
"win",
"=",
"13",
",",
"remove_outliers",
"=",
"False",
")",
":",
"if",
"remove_outliers",
":",
"# Remove 5-sigma outliers from data",
"# smoothed on a 1 day timescale",
"if",
"len",
"(",
"y",
")",
">=",
"50",
":",
"ys",
"=",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | SavGol | Subtracts a second order Savitsky-Golay filter with window size `win`
and returns the result. This acts as a high pass filter. | everest/mathutils.py | def SavGol(y, win=49):
'''
Subtracts a second order Savitsky-Golay filter with window size `win`
and returns the result. This acts as a high pass filter.
'''
if len(y) >= win:
return y - savgol_filter(y, win, 2) + np.nanmedian(y)
else:
return y | def SavGol(y, win=49):
'''
Subtracts a second order Savitsky-Golay filter with window size `win`
and returns the result. This acts as a high pass filter.
'''
if len(y) >= win:
return y - savgol_filter(y, win, 2) + np.nanmedian(y)
else:
return y | [
"Subtracts",
"a",
"second",
"order",
"Savitsky",
"-",
"Golay",
"filter",
"with",
"window",
"size",
"win",
"and",
"returns",
"the",
"result",
".",
"This",
"acts",
"as",
"a",
"high",
"pass",
"filter",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/mathutils.py#L139-L149 | [
"def",
"SavGol",
"(",
"y",
",",
"win",
"=",
"49",
")",
":",
"if",
"len",
"(",
"y",
")",
">=",
"win",
":",
"return",
"y",
"-",
"savgol_filter",
"(",
"y",
",",
"win",
",",
"2",
")",
"+",
"np",
".",
"nanmedian",
"(",
"y",
")",
"else",
":",
"re... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | NumRegressors | Return the number of regressors for `npix` pixels
and PLD order `pld_order`.
:param bool cross_terms: Include pixel cross-terms? Default :py:obj:`True` | everest/mathutils.py | def NumRegressors(npix, pld_order, cross_terms=True):
'''
Return the number of regressors for `npix` pixels
and PLD order `pld_order`.
:param bool cross_terms: Include pixel cross-terms? Default :py:obj:`True`
'''
res = 0
for k in range(1, pld_order + 1):
if cross_terms:
... | def NumRegressors(npix, pld_order, cross_terms=True):
'''
Return the number of regressors for `npix` pixels
and PLD order `pld_order`.
:param bool cross_terms: Include pixel cross-terms? Default :py:obj:`True`
'''
res = 0
for k in range(1, pld_order + 1):
if cross_terms:
... | [
"Return",
"the",
"number",
"of",
"regressors",
"for",
"npix",
"pixels",
"and",
"PLD",
"order",
"pld_order",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/mathutils.py#L152-L167 | [
"def",
"NumRegressors",
"(",
"npix",
",",
"pld_order",
",",
"cross_terms",
"=",
"True",
")",
":",
"res",
"=",
"0",
"for",
"k",
"in",
"range",
"(",
"1",
",",
"pld_order",
"+",
"1",
")",
":",
"if",
"cross_terms",
":",
"res",
"+=",
"comb",
"(",
"npix"... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Downbin | Downbins an array to a smaller size.
:param array_like x: The array to down-bin
:param int newsize: The new size of the axis along which to down-bin
:param int axis: The axis to operate on. Default 0
:param str operation: The operation to perform when down-binning. \
Default `mean` | everest/mathutils.py | def Downbin(x, newsize, axis=0, operation='mean'):
'''
Downbins an array to a smaller size.
:param array_like x: The array to down-bin
:param int newsize: The new size of the axis along which to down-bin
:param int axis: The axis to operate on. Default 0
:param str operation: The operation to p... | def Downbin(x, newsize, axis=0, operation='mean'):
'''
Downbins an array to a smaller size.
:param array_like x: The array to down-bin
:param int newsize: The new size of the axis along which to down-bin
:param int axis: The axis to operate on. Default 0
:param str operation: The operation to p... | [
"Downbins",
"an",
"array",
"to",
"a",
"smaller",
"size",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/mathutils.py#L170-L205 | [
"def",
"Downbin",
"(",
"x",
",",
"newsize",
",",
"axis",
"=",
"0",
",",
"operation",
"=",
"'mean'",
")",
":",
"assert",
"newsize",
"<",
"x",
".",
"shape",
"[",
"axis",
"]",
",",
"\"The new size of the array must be smaller than the current size.\"",
"oldsize",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Field.register_with_model | Called during the creation of a the :class:`StdModel`
class when :class:`Metaclass` is initialised. It fills
:attr:`Field.name` and :attr:`Field.model`. This is an internal
function users should never call. | stdnet/odm/fields.py | def register_with_model(self, name, model):
'''Called during the creation of a the :class:`StdModel`
class when :class:`Metaclass` is initialised. It fills
:attr:`Field.name` and :attr:`Field.model`. This is an internal
function users should never call.'''
if self.name:
raise FieldError('Fie... | def register_with_model(self, name, model):
'''Called during the creation of a the :class:`StdModel`
class when :class:`Metaclass` is initialised. It fills
:attr:`Field.name` and :attr:`Field.model`. This is an internal
function users should never call.'''
if self.name:
raise FieldError('Fie... | [
"Called",
"during",
"the",
"creation",
"of",
"a",
"the",
":",
"class",
":",
"StdModel",
"class",
"when",
":",
"class",
":",
"Metaclass",
"is",
"initialised",
".",
"It",
"fills",
":",
"attr",
":",
"Field",
".",
"name",
"and",
":",
"attr",
":",
"Field",
... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/fields.py#L192-L210 | [
"def",
"register_with_model",
"(",
"self",
",",
"name",
",",
"model",
")",
":",
"if",
"self",
".",
"name",
":",
"raise",
"FieldError",
"(",
"'Field %s is already registered\\\n with a model'",
"%",
"self",
")",
"self",
".",
"name",
"=",
"name",
"self",
".",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Field.add_to_fields | Add this :class:`Field` to the fields of :attr:`model`. | stdnet/odm/fields.py | def add_to_fields(self):
'''Add this :class:`Field` to the fields of :attr:`model`.'''
meta = self.model._meta
meta.scalarfields.append(self)
if self.index:
meta.indices.append(self) | def add_to_fields(self):
'''Add this :class:`Field` to the fields of :attr:`model`.'''
meta = self.model._meta
meta.scalarfields.append(self)
if self.index:
meta.indices.append(self) | [
"Add",
"this",
":",
"class",
":",
"Field",
"to",
"the",
"fields",
"of",
":",
"attr",
":",
"model",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/fields.py#L212-L217 | [
"def",
"add_to_fields",
"(",
"self",
")",
":",
"meta",
"=",
"self",
".",
"model",
".",
"_meta",
"meta",
".",
"scalarfields",
".",
"append",
"(",
"self",
")",
"if",
"self",
".",
"index",
":",
"meta",
".",
"indices",
".",
"append",
"(",
"self",
")"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Field.get_lookup | called by the :class:`Query` method when it needs to build
lookup on fields with additional nested fields. This is the case of
:class:`ForeignKey` and :class:`JSONField`.
:param remaining: the :ref:`double underscored` fields if this :class:`Field`
:param errorClass: Optional exception class to use if the *remaining* ... | stdnet/odm/fields.py | def get_lookup(self, remaining, errorClass=ValueError):
'''called by the :class:`Query` method when it needs to build
lookup on fields with additional nested fields. This is the case of
:class:`ForeignKey` and :class:`JSONField`.
:param remaining: the :ref:`double underscored` fields if this :class:`Field`
:pa... | def get_lookup(self, remaining, errorClass=ValueError):
'''called by the :class:`Query` method when it needs to build
lookup on fields with additional nested fields. This is the case of
:class:`ForeignKey` and :class:`JSONField`.
:param remaining: the :ref:`double underscored` fields if this :class:`Field`
:pa... | [
"called",
"by",
"the",
":",
"class",
":",
"Query",
"method",
"when",
"it",
"needs",
"to",
"build",
"lookup",
"on",
"fields",
"with",
"additional",
"nested",
"fields",
".",
"This",
"is",
"the",
"case",
"of",
":",
"class",
":",
"ForeignKey",
"and",
":",
... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/fields.py#L254-L264 | [
"def",
"get_lookup",
"(",
"self",
",",
"remaining",
",",
"errorClass",
"=",
"ValueError",
")",
":",
"if",
"remaining",
":",
"raise",
"errorClass",
"(",
"'Cannot use nested lookup on field %s'",
"%",
"self",
")",
"return",
"(",
"self",
".",
"attname",
",",
"Non... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Field.get_value | Retrieve the value :class:`Field` from a :class:`StdModel`
``instance``.
:param instance: The :class:`StdModel` ``instance`` invoking this function.
:param bits: Additional information for nested fields which derives from
the :ref:`double underscore <tutorial-underscore>` notation.
:return: the value of this :clas... | stdnet/odm/fields.py | def get_value(self, instance, *bits):
'''Retrieve the value :class:`Field` from a :class:`StdModel`
``instance``.
:param instance: The :class:`StdModel` ``instance`` invoking this function.
:param bits: Additional information for nested fields which derives from
the :ref:`double underscore <tutorial-unders... | def get_value(self, instance, *bits):
'''Retrieve the value :class:`Field` from a :class:`StdModel`
``instance``.
:param instance: The :class:`StdModel` ``instance`` invoking this function.
:param bits: Additional information for nested fields which derives from
the :ref:`double underscore <tutorial-unders... | [
"Retrieve",
"the",
"value",
":",
"class",
":",
"Field",
"from",
"a",
":",
"class",
":",
"StdModel",
"instance",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/fields.py#L272-L288 | [
"def",
"get_value",
"(",
"self",
",",
"instance",
",",
"*",
"bits",
")",
":",
"if",
"bits",
":",
"raise",
"AttributeError",
"else",
":",
"return",
"getattr",
"(",
"instance",
",",
"self",
".",
"attname",
")"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Field.set_value | Set the ``value`` for this :class:`Field` in a ``instance``
of a :class:`StdModel`. | stdnet/odm/fields.py | def set_value(self, instance, value):
'''Set the ``value`` for this :class:`Field` in a ``instance``
of a :class:`StdModel`.'''
setattr(instance, self.attname, self.to_python(value)) | def set_value(self, instance, value):
'''Set the ``value`` for this :class:`Field` in a ``instance``
of a :class:`StdModel`.'''
setattr(instance, self.attname, self.to_python(value)) | [
"Set",
"the",
"value",
"for",
"this",
":",
"class",
":",
"Field",
"in",
"a",
"instance",
"of",
"a",
":",
"class",
":",
"StdModel",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/fields.py#L290-L293 | [
"def",
"set_value",
"(",
"self",
",",
"instance",
",",
"value",
")",
":",
"setattr",
"(",
"instance",
",",
"self",
".",
"attname",
",",
"self",
".",
"to_python",
"(",
"value",
")",
")"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | lookup | lookup the value of the var_name on the stack of contexts
:var_name: TODO
:contexts: TODO
:returns: None if not found | pymustache/mustache.py | def lookup(var_name, contexts=(), start=0):
"""lookup the value of the var_name on the stack of contexts
:var_name: TODO
:contexts: TODO
:returns: None if not found
"""
start = len(contexts) if start >=0 else start
for context in reversed(contexts[:start]):
try:
if var_... | def lookup(var_name, contexts=(), start=0):
"""lookup the value of the var_name on the stack of contexts
:var_name: TODO
:contexts: TODO
:returns: None if not found
"""
start = len(contexts) if start >=0 else start
for context in reversed(contexts[:start]):
try:
if var_... | [
"lookup",
"the",
"value",
"of",
"the",
"var_name",
"on",
"the",
"stack",
"of",
"contexts"
] | lotabout/pymustache | python | https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L34-L50 | [
"def",
"lookup",
"(",
"var_name",
",",
"contexts",
"=",
"(",
")",
",",
"start",
"=",
"0",
")",
":",
"start",
"=",
"len",
"(",
"contexts",
")",
"if",
"start",
">=",
"0",
"else",
"start",
"for",
"context",
"in",
"reversed",
"(",
"contexts",
"[",
":",... | d4089e49cda01fc11bab0c986d95e25150a60bac |
train | delimiters_to_re | convert delimiters to corresponding regular expressions | pymustache/mustache.py | def delimiters_to_re(delimiters):
"""convert delimiters to corresponding regular expressions"""
# caching
delimiters = tuple(delimiters)
if delimiters in re_delimiters:
re_tag = re_delimiters[delimiters]
else:
open_tag, close_tag = delimiters
# escape
open_tag = ''.... | def delimiters_to_re(delimiters):
"""convert delimiters to corresponding regular expressions"""
# caching
delimiters = tuple(delimiters)
if delimiters in re_delimiters:
re_tag = re_delimiters[delimiters]
else:
open_tag, close_tag = delimiters
# escape
open_tag = ''.... | [
"convert",
"delimiters",
"to",
"corresponding",
"regular",
"expressions"
] | lotabout/pymustache | python | https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L69-L86 | [
"def",
"delimiters_to_re",
"(",
"delimiters",
")",
":",
"# caching",
"delimiters",
"=",
"tuple",
"(",
"delimiters",
")",
"if",
"delimiters",
"in",
"re_delimiters",
":",
"re_tag",
"=",
"re_delimiters",
"[",
"delimiters",
"]",
"else",
":",
"open_tag",
",",
"clos... | d4089e49cda01fc11bab0c986d95e25150a60bac |
train | is_standalone | check if the string text[start:end] is standalone by checking forwards
and backwards for blankspaces
:text: TODO
:(start, end): TODO
:returns: the start of next index after text[start:end] | pymustache/mustache.py | def is_standalone(text, start, end):
"""check if the string text[start:end] is standalone by checking forwards
and backwards for blankspaces
:text: TODO
:(start, end): TODO
:returns: the start of next index after text[start:end]
"""
left = False
start -= 1
while start >= 0 and text[... | def is_standalone(text, start, end):
"""check if the string text[start:end] is standalone by checking forwards
and backwards for blankspaces
:text: TODO
:(start, end): TODO
:returns: the start of next index after text[start:end]
"""
left = False
start -= 1
while start >= 0 and text[... | [
"check",
"if",
"the",
"string",
"text",
"[",
"start",
":",
"end",
"]",
"is",
"standalone",
"by",
"checking",
"forwards",
"and",
"backwards",
"for",
"blankspaces",
":",
"text",
":",
"TODO",
":",
"(",
"start",
"end",
")",
":",
"TODO",
":",
"returns",
":"... | lotabout/pymustache | python | https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L91-L108 | [
"def",
"is_standalone",
"(",
"text",
",",
"start",
",",
"end",
")",
":",
"left",
"=",
"False",
"start",
"-=",
"1",
"while",
"start",
">=",
"0",
"and",
"text",
"[",
"start",
"]",
"in",
"spaces_not_newline",
":",
"start",
"-=",
"1",
"if",
"start",
"<",... | d4089e49cda01fc11bab0c986d95e25150a60bac |
train | compiled | Compile a template into token tree
:template: TODO
:delimiters: TODO
:returns: the root token | pymustache/mustache.py | def compiled(template, delimiters=DEFAULT_DELIMITERS):
"""Compile a template into token tree
:template: TODO
:delimiters: TODO
:returns: the root token
"""
re_tag = delimiters_to_re(delimiters)
# variable to save states
tokens = []
index = 0
sections = []
tokens_stack = []... | def compiled(template, delimiters=DEFAULT_DELIMITERS):
"""Compile a template into token tree
:template: TODO
:delimiters: TODO
:returns: the root token
"""
re_tag = delimiters_to_re(delimiters)
# variable to save states
tokens = []
index = 0
sections = []
tokens_stack = []... | [
"Compile",
"a",
"template",
"into",
"token",
"tree"
] | lotabout/pymustache | python | https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L110-L229 | [
"def",
"compiled",
"(",
"template",
",",
"delimiters",
"=",
"DEFAULT_DELIMITERS",
")",
":",
"re_tag",
"=",
"delimiters_to_re",
"(",
"delimiters",
")",
"# variable to save states",
"tokens",
"=",
"[",
"]",
"index",
"=",
"0",
"sections",
"=",
"[",
"]",
"tokens_s... | d4089e49cda01fc11bab0c986d95e25150a60bac |
train | Token._escape | Escape text according to self.escape | pymustache/mustache.py | def _escape(self, text):
"""Escape text according to self.escape"""
ret = EMPTYSTRING if text is None else str(text)
if self.escape:
return html_escape(ret)
else:
return ret | def _escape(self, text):
"""Escape text according to self.escape"""
ret = EMPTYSTRING if text is None else str(text)
if self.escape:
return html_escape(ret)
else:
return ret | [
"Escape",
"text",
"according",
"to",
"self",
".",
"escape"
] | lotabout/pymustache | python | https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L263-L269 | [
"def",
"_escape",
"(",
"self",
",",
"text",
")",
":",
"ret",
"=",
"EMPTYSTRING",
"if",
"text",
"is",
"None",
"else",
"str",
"(",
"text",
")",
"if",
"self",
".",
"escape",
":",
"return",
"html_escape",
"(",
"ret",
")",
"else",
":",
"return",
"ret"
] | d4089e49cda01fc11bab0c986d95e25150a60bac |
train | Token._lookup | lookup value for names like 'a.b.c' and handle filters as well | pymustache/mustache.py | def _lookup(self, dot_name, contexts):
"""lookup value for names like 'a.b.c' and handle filters as well"""
# process filters
filters = [x for x in map(lambda x: x.strip(), dot_name.split('|'))]
dot_name = filters[0]
filters = filters[1:]
# should support paths like '..... | def _lookup(self, dot_name, contexts):
"""lookup value for names like 'a.b.c' and handle filters as well"""
# process filters
filters = [x for x in map(lambda x: x.strip(), dot_name.split('|'))]
dot_name = filters[0]
filters = filters[1:]
# should support paths like '..... | [
"lookup",
"value",
"for",
"names",
"like",
"a",
".",
"b",
".",
"c",
"and",
"handle",
"filters",
"as",
"well"
] | lotabout/pymustache | python | https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L271-L332 | [
"def",
"_lookup",
"(",
"self",
",",
"dot_name",
",",
"contexts",
")",
":",
"# process filters",
"filters",
"=",
"[",
"x",
"for",
"x",
"in",
"map",
"(",
"lambda",
"x",
":",
"x",
".",
"strip",
"(",
")",
",",
"dot_name",
".",
"split",
"(",
"'|'",
")",... | d4089e49cda01fc11bab0c986d95e25150a60bac |
train | Token._render_children | Render the children tokens | pymustache/mustache.py | def _render_children(self, contexts, partials):
"""Render the children tokens"""
ret = []
for child in self.children:
ret.append(child._render(contexts, partials))
return EMPTYSTRING.join(ret) | def _render_children(self, contexts, partials):
"""Render the children tokens"""
ret = []
for child in self.children:
ret.append(child._render(contexts, partials))
return EMPTYSTRING.join(ret) | [
"Render",
"the",
"children",
"tokens"
] | lotabout/pymustache | python | https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L334-L339 | [
"def",
"_render_children",
"(",
"self",
",",
"contexts",
",",
"partials",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"child",
"in",
"self",
".",
"children",
":",
"ret",
".",
"append",
"(",
"child",
".",
"_render",
"(",
"contexts",
",",
"partials",
")",
"... | d4089e49cda01fc11bab0c986d95e25150a60bac |
train | Variable._render | render variable | pymustache/mustache.py | def _render(self, contexts, partials):
"""render variable"""
value = self._lookup(self.value, contexts)
# lambda
if callable(value):
value = inner_render(str(value()), contexts, partials)
return self._escape(value) | def _render(self, contexts, partials):
"""render variable"""
value = self._lookup(self.value, contexts)
# lambda
if callable(value):
value = inner_render(str(value()), contexts, partials)
return self._escape(value) | [
"render",
"variable"
] | lotabout/pymustache | python | https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L385-L393 | [
"def",
"_render",
"(",
"self",
",",
"contexts",
",",
"partials",
")",
":",
"value",
"=",
"self",
".",
"_lookup",
"(",
"self",
".",
"value",
",",
"contexts",
")",
"# lambda",
"if",
"callable",
"(",
"value",
")",
":",
"value",
"=",
"inner_render",
"(",
... | d4089e49cda01fc11bab0c986d95e25150a60bac |
train | Section._render | render section | pymustache/mustache.py | def _render(self, contexts, partials):
"""render section"""
val = self._lookup(self.value, contexts)
if not val:
# false value
return EMPTYSTRING
# normally json has types: number/string/list/map
# but python has more, so we decide that map and string sho... | def _render(self, contexts, partials):
"""render section"""
val = self._lookup(self.value, contexts)
if not val:
# false value
return EMPTYSTRING
# normally json has types: number/string/list/map
# but python has more, so we decide that map and string sho... | [
"render",
"section"
] | lotabout/pymustache | python | https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L400-L434 | [
"def",
"_render",
"(",
"self",
",",
"contexts",
",",
"partials",
")",
":",
"val",
"=",
"self",
".",
"_lookup",
"(",
"self",
".",
"value",
",",
"contexts",
")",
"if",
"not",
"val",
":",
"# false value",
"return",
"EMPTYSTRING",
"# normally json has types: num... | d4089e49cda01fc11bab0c986d95e25150a60bac |
train | Inverted._render | render inverted section | pymustache/mustache.py | def _render(self, contexts, partials):
"""render inverted section"""
val = self._lookup(self.value, contexts)
if val:
return EMPTYSTRING
return self._render_children(contexts, partials) | def _render(self, contexts, partials):
"""render inverted section"""
val = self._lookup(self.value, contexts)
if val:
return EMPTYSTRING
return self._render_children(contexts, partials) | [
"render",
"inverted",
"section"
] | lotabout/pymustache | python | https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L442-L447 | [
"def",
"_render",
"(",
"self",
",",
"contexts",
",",
"partials",
")",
":",
"val",
"=",
"self",
".",
"_lookup",
"(",
"self",
".",
"value",
",",
"contexts",
")",
"if",
"val",
":",
"return",
"EMPTYSTRING",
"return",
"self",
".",
"_render_children",
"(",
"... | d4089e49cda01fc11bab0c986d95e25150a60bac |
train | Partial._render | render partials | pymustache/mustache.py | def _render(self, contexts, partials):
"""render partials"""
try:
partial = partials[self.value]
except KeyError as e:
return self._escape(EMPTYSTRING)
partial = re_insert_indent.sub(r'\1' + ' '*self.indent, partial)
return inner_render(partial, contexts... | def _render(self, contexts, partials):
"""render partials"""
try:
partial = partials[self.value]
except KeyError as e:
return self._escape(EMPTYSTRING)
partial = re_insert_indent.sub(r'\1' + ' '*self.indent, partial)
return inner_render(partial, contexts... | [
"render",
"partials"
] | lotabout/pymustache | python | https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L465-L474 | [
"def",
"_render",
"(",
"self",
",",
"contexts",
",",
"partials",
")",
":",
"try",
":",
"partial",
"=",
"partials",
"[",
"self",
".",
"value",
"]",
"except",
"KeyError",
"as",
"e",
":",
"return",
"self",
".",
"_escape",
"(",
"EMPTYSTRING",
")",
"partial... | d4089e49cda01fc11bab0c986d95e25150a60bac |
train | Setup | Called when the code is installed. Sets up directories and downloads
the K2 catalog. | everest/missions/k2/k2.py | def Setup():
'''
Called when the code is installed. Sets up directories and downloads
the K2 catalog.
'''
if not os.path.exists(os.path.join(EVEREST_DAT, 'k2', 'cbv')):
os.makedirs(os.path.join(EVEREST_DAT, 'k2', 'cbv'))
GetK2Stars(clobber=False) | def Setup():
'''
Called when the code is installed. Sets up directories and downloads
the K2 catalog.
'''
if not os.path.exists(os.path.join(EVEREST_DAT, 'k2', 'cbv')):
os.makedirs(os.path.join(EVEREST_DAT, 'k2', 'cbv'))
GetK2Stars(clobber=False) | [
"Called",
"when",
"the",
"code",
"is",
"installed",
".",
"Sets",
"up",
"directories",
"and",
"downloads",
"the",
"K2",
"catalog",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L50-L59 | [
"def",
"Setup",
"(",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"join",
"(",
"EVEREST_DAT",
",",
"'k2'",
",",
"'cbv'",
")",
")",
":",
"os",
".",
"makedirs",
"(",
"os",
".",
"path",
".",
"join",
"(",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | CDPP | Compute the proxy 6-hr CDPP metric.
:param array_like flux: The flux array to compute the CDPP for
:param array_like mask: The indices to be masked
:param str cadence: The light curve cadence. Default `lc` | everest/missions/k2/k2.py | def CDPP(flux, mask=[], cadence='lc'):
'''
Compute the proxy 6-hr CDPP metric.
:param array_like flux: The flux array to compute the CDPP for
:param array_like mask: The indices to be masked
:param str cadence: The light curve cadence. Default `lc`
'''
# 13 cadences is 6.5 hours
rmswi... | def CDPP(flux, mask=[], cadence='lc'):
'''
Compute the proxy 6-hr CDPP metric.
:param array_like flux: The flux array to compute the CDPP for
:param array_like mask: The indices to be masked
:param str cadence: The light curve cadence. Default `lc`
'''
# 13 cadences is 6.5 hours
rmswi... | [
"Compute",
"the",
"proxy",
"6",
"-",
"hr",
"CDPP",
"metric",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L169-L194 | [
"def",
"CDPP",
"(",
"flux",
",",
"mask",
"=",
"[",
"]",
",",
"cadence",
"=",
"'lc'",
")",
":",
"# 13 cadences is 6.5 hours",
"rmswin",
"=",
"13",
"# Smooth the data on a 2 day timescale",
"svgwin",
"=",
"49",
"# If short cadence, need to downbin",
"if",
"cadence",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | GetData | Returns a :py:obj:`DataContainer` instance with the
raw data for the target.
:param int EPIC: The EPIC ID number
:param int season: The observing season (campaign). Default :py:obj:`None`
:param str cadence: The light curve cadence. Default `lc`
:param bool clobber: Overwrite existing files? Defaul... | everest/missions/k2/k2.py | def GetData(EPIC, season=None, cadence='lc', clobber=False, delete_raw=False,
aperture_name='k2sff_15', saturated_aperture_name='k2sff_19',
max_pixels=75, download_only=False, saturation_tolerance=-0.1,
bad_bits=[1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17],
get_hir... | def GetData(EPIC, season=None, cadence='lc', clobber=False, delete_raw=False,
aperture_name='k2sff_15', saturated_aperture_name='k2sff_19',
max_pixels=75, download_only=False, saturation_tolerance=-0.1,
bad_bits=[1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17],
get_hir... | [
"Returns",
"a",
":",
"py",
":",
"obj",
":",
"DataContainer",
"instance",
"with",
"the",
"raw",
"data",
"for",
"the",
"target",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L197-L712 | [
"def",
"GetData",
"(",
"EPIC",
",",
"season",
"=",
"None",
",",
"cadence",
"=",
"'lc'",
",",
"clobber",
"=",
"False",
",",
"delete_raw",
"=",
"False",
",",
"aperture_name",
"=",
"'k2sff_15'",
",",
"saturated_aperture_name",
"=",
"'k2sff_19'",
",",
"max_pixel... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | GetNeighbors | Return `neighbors` random bright stars on the same module as `EPIC`.
:param int EPIC: The EPIC ID number
:param str model: The :py:obj:`everest` model name. Only used when \
imposing CDPP bounds. Default :py:obj:`None`
:param int neighbors: Number of neighbors to return. Default 10
:param st... | everest/missions/k2/k2.py | def GetNeighbors(EPIC, season=None, model=None, neighbors=10,
mag_range=(11., 13.),
cdpp_range=None, aperture_name='k2sff_15',
cadence='lc', **kwargs):
'''
Return `neighbors` random bright stars on the same module as `EPIC`.
:param int EPIC: The EPIC ID nu... | def GetNeighbors(EPIC, season=None, model=None, neighbors=10,
mag_range=(11., 13.),
cdpp_range=None, aperture_name='k2sff_15',
cadence='lc', **kwargs):
'''
Return `neighbors` random bright stars on the same module as `EPIC`.
:param int EPIC: The EPIC ID nu... | [
"Return",
"neighbors",
"random",
"bright",
"stars",
"on",
"the",
"same",
"module",
"as",
"EPIC",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L715-L881 | [
"def",
"GetNeighbors",
"(",
"EPIC",
",",
"season",
"=",
"None",
",",
"model",
"=",
"None",
",",
"neighbors",
"=",
"10",
",",
"mag_range",
"=",
"(",
"11.",
",",
"13.",
")",
",",
"cdpp_range",
"=",
"None",
",",
"aperture_name",
"=",
"'k2sff_15'",
",",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | PlanetStatistics | Computes and plots the CDPP statistics comparison between `model` and
`compare_to` for all known K2 planets.
:param str model: The :py:obj:`everest` model name
:param str compare_to: The :py:obj:`everest` model name or \
other K2 pipeline name | everest/missions/k2/k2.py | def PlanetStatistics(model='nPLD', compare_to='k2sff', **kwargs):
'''
Computes and plots the CDPP statistics comparison between `model` and
`compare_to` for all known K2 planets.
:param str model: The :py:obj:`everest` model name
:param str compare_to: The :py:obj:`everest` model name or \
... | def PlanetStatistics(model='nPLD', compare_to='k2sff', **kwargs):
'''
Computes and plots the CDPP statistics comparison between `model` and
`compare_to` for all known K2 planets.
:param str model: The :py:obj:`everest` model name
:param str compare_to: The :py:obj:`everest` model name or \
... | [
"Computes",
"and",
"plots",
"the",
"CDPP",
"statistics",
"comparison",
"between",
"model",
"and",
"compare_to",
"for",
"all",
"known",
"K2",
"planets",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L884-L961 | [
"def",
"PlanetStatistics",
"(",
"model",
"=",
"'nPLD'",
",",
"compare_to",
"=",
"'k2sff'",
",",
"*",
"*",
"kwargs",
")",
":",
"# Load all planet hosts",
"f",
"=",
"os",
".",
"path",
".",
"join",
"(",
"EVEREST_SRC",
",",
"'missions'",
",",
"'k2'",
",",
"'... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | ShortCadenceStatistics | Computes and plots the CDPP statistics comparison between short cadence
and long cadence de-trended light curves
:param campaign: The campaign number or list of campaign numbers. \
Default is to plot all campaigns
:param bool clobber: Overwrite existing files? Default :py:obj:`False`
:param ... | everest/missions/k2/k2.py | def ShortCadenceStatistics(campaign=None, clobber=False, model='nPLD',
plot=True, **kwargs):
'''
Computes and plots the CDPP statistics comparison between short cadence
and long cadence de-trended light curves
:param campaign: The campaign number or list of campaign numbers. ... | def ShortCadenceStatistics(campaign=None, clobber=False, model='nPLD',
plot=True, **kwargs):
'''
Computes and plots the CDPP statistics comparison between short cadence
and long cadence de-trended light curves
:param campaign: The campaign number or list of campaign numbers. ... | [
"Computes",
"and",
"plots",
"the",
"CDPP",
"statistics",
"comparison",
"between",
"short",
"cadence",
"and",
"long",
"cadence",
"de",
"-",
"trended",
"light",
"curves"
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L964-L1119 | [
"def",
"ShortCadenceStatistics",
"(",
"campaign",
"=",
"None",
",",
"clobber",
"=",
"False",
",",
"model",
"=",
"'nPLD'",
",",
"plot",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# Check campaign",
"if",
"campaign",
"is",
"None",
":",
"campaign",
"=... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Statistics | Computes and plots the CDPP statistics comparison between `model`
and `compare_to` for all long cadence light curves in a given campaign
:param season: The campaign number or list of campaign numbers. \
Default is to plot all campaigns
:param bool clobber: Overwrite existing files? Default :py:o... | everest/missions/k2/k2.py | def Statistics(season=None, clobber=False, model='nPLD', injection=False,
compare_to='kepler', plot=True, cadence='lc', planets=False,
**kwargs):
'''
Computes and plots the CDPP statistics comparison between `model`
and `compare_to` for all long cadence light curves in a given ... | def Statistics(season=None, clobber=False, model='nPLD', injection=False,
compare_to='kepler', plot=True, cadence='lc', planets=False,
**kwargs):
'''
Computes and plots the CDPP statistics comparison between `model`
and `compare_to` for all long cadence light curves in a given ... | [
"Computes",
"and",
"plots",
"the",
"CDPP",
"statistics",
"comparison",
"between",
"model",
"and",
"compare_to",
"for",
"all",
"long",
"cadence",
"light",
"curves",
"in",
"a",
"given",
"campaign"
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L1122-L1446 | [
"def",
"Statistics",
"(",
"season",
"=",
"None",
",",
"clobber",
"=",
"False",
",",
"model",
"=",
"'nPLD'",
",",
"injection",
"=",
"False",
",",
"compare_to",
"=",
"'kepler'",
",",
"plot",
"=",
"True",
",",
"cadence",
"=",
"'lc'",
",",
"planets",
"=",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | HasShortCadence | Returns `True` if short cadence data is available for this target.
:param int EPIC: The EPIC ID number
:param int season: The campaign number. Default :py:obj:`None` | everest/missions/k2/k2.py | def HasShortCadence(EPIC, season=None):
'''
Returns `True` if short cadence data is available for this target.
:param int EPIC: The EPIC ID number
:param int season: The campaign number. Default :py:obj:`None`
'''
if season is None:
season = Campaign(EPIC)
if season is None:
... | def HasShortCadence(EPIC, season=None):
'''
Returns `True` if short cadence data is available for this target.
:param int EPIC: The EPIC ID number
:param int season: The campaign number. Default :py:obj:`None`
'''
if season is None:
season = Campaign(EPIC)
if season is None:
... | [
"Returns",
"True",
"if",
"short",
"cadence",
"data",
"is",
"available",
"for",
"this",
"target",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L1449-L1467 | [
"def",
"HasShortCadence",
"(",
"EPIC",
",",
"season",
"=",
"None",
")",
":",
"if",
"season",
"is",
"None",
":",
"season",
"=",
"Campaign",
"(",
"EPIC",
")",
"if",
"season",
"is",
"None",
":",
"return",
"None",
"stars",
"=",
"GetK2Campaign",
"(",
"seaso... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | InjectionStatistics | Computes and plots the statistics for injection/recovery tests.
:param int campaign: The campaign number. Default 0
:param str model: The :py:obj:`everest` model name
:param bool plot: Default :py:obj:`True`
:param bool show: Show the plot? Default :py:obj:`True`. \
If :py:obj:`False`, retur... | everest/missions/k2/k2.py | def InjectionStatistics(campaign=0, clobber=False, model='nPLD', plot=True,
show=True, **kwargs):
'''
Computes and plots the statistics for injection/recovery tests.
:param int campaign: The campaign number. Default 0
:param str model: The :py:obj:`everest` model name
:param... | def InjectionStatistics(campaign=0, clobber=False, model='nPLD', plot=True,
show=True, **kwargs):
'''
Computes and plots the statistics for injection/recovery tests.
:param int campaign: The campaign number. Default 0
:param str model: The :py:obj:`everest` model name
:param... | [
"Computes",
"and",
"plots",
"the",
"statistics",
"for",
"injection",
"/",
"recovery",
"tests",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L1470-L1656 | [
"def",
"InjectionStatistics",
"(",
"campaign",
"=",
"0",
",",
"clobber",
"=",
"False",
",",
"model",
"=",
"'nPLD'",
",",
"plot",
"=",
"True",
",",
"show",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# Compute the statistics",
"stars",
"=",
"GetK2Cam... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | HDUCards | Generates HDU cards for inclusion in the de-trended light curve FITS file.
Used internally. | everest/missions/k2/k2.py | def HDUCards(headers, hdu=0):
'''
Generates HDU cards for inclusion in the de-trended light curve FITS file.
Used internally.
'''
if headers is None:
return []
if hdu == 0:
# Get info from the TPF Primary HDU Header
tpf_header = headers[0]
entries = ['TELESCOP'... | def HDUCards(headers, hdu=0):
'''
Generates HDU cards for inclusion in the de-trended light curve FITS file.
Used internally.
'''
if headers is None:
return []
if hdu == 0:
# Get info from the TPF Primary HDU Header
tpf_header = headers[0]
entries = ['TELESCOP'... | [
"Generates",
"HDU",
"cards",
"for",
"inclusion",
"in",
"the",
"de",
"-",
"trended",
"light",
"curve",
"FITS",
"file",
".",
"Used",
"internally",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L1659-L1763 | [
"def",
"HDUCards",
"(",
"headers",
",",
"hdu",
"=",
"0",
")",
":",
"if",
"headers",
"is",
"None",
":",
"return",
"[",
"]",
"if",
"hdu",
"==",
"0",
":",
"# Get info from the TPF Primary HDU Header",
"tpf_header",
"=",
"headers",
"[",
"0",
"]",
"entries",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | TargetDirectory | Returns the location of the :py:mod:`everest` data on disk
for a given target.
:param ID: The target ID
:param int season: The target season number
:param bool relative: Relative path? Default :py:obj:`False` | everest/missions/k2/k2.py | def TargetDirectory(ID, season, relative=False, **kwargs):
'''
Returns the location of the :py:mod:`everest` data on disk
for a given target.
:param ID: The target ID
:param int season: The target season number
:param bool relative: Relative path? Default :py:obj:`False`
'''
if season... | def TargetDirectory(ID, season, relative=False, **kwargs):
'''
Returns the location of the :py:mod:`everest` data on disk
for a given target.
:param ID: The target ID
:param int season: The target season number
:param bool relative: Relative path? Default :py:obj:`False`
'''
if season... | [
"Returns",
"the",
"location",
"of",
"the",
":",
"py",
":",
"mod",
":",
"everest",
"data",
"on",
"disk",
"for",
"a",
"given",
"target",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L1766-L1785 | [
"def",
"TargetDirectory",
"(",
"ID",
",",
"season",
",",
"relative",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"season",
"is",
"None",
":",
"return",
"None",
"if",
"relative",
":",
"path",
"=",
"''",
"else",
":",
"path",
"=",
"EVEREST_DA... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | DVSFile | Returns the name of the DVS PDF for a given target.
:param ID: The target ID
:param int season: The target season number
:param str cadence: The cadence type. Default `lc` | everest/missions/k2/k2.py | def DVSFile(ID, season, cadence='lc'):
'''
Returns the name of the DVS PDF for a given target.
:param ID: The target ID
:param int season: The target season number
:param str cadence: The cadence type. Default `lc`
'''
if cadence == 'sc':
strcadence = '_sc'
else:
strca... | def DVSFile(ID, season, cadence='lc'):
'''
Returns the name of the DVS PDF for a given target.
:param ID: The target ID
:param int season: The target season number
:param str cadence: The cadence type. Default `lc`
'''
if cadence == 'sc':
strcadence = '_sc'
else:
strca... | [
"Returns",
"the",
"name",
"of",
"the",
"DVS",
"PDF",
"for",
"a",
"given",
"target",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L1801-L1816 | [
"def",
"DVSFile",
"(",
"ID",
",",
"season",
",",
"cadence",
"=",
"'lc'",
")",
":",
"if",
"cadence",
"==",
"'sc'",
":",
"strcadence",
"=",
"'_sc'",
"else",
":",
"strcadence",
"=",
"''",
"return",
"'hlsp_everest_k2_llc_%d-c%02d_kepler_v%s_dvs%s.pdf'",
"%",
"(",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | GetTargetCBVs | Returns the design matrix of CBVs for the given target.
:param model: An instance of the :py:obj:`everest` model for the target | everest/missions/k2/k2.py | def GetTargetCBVs(model):
'''
Returns the design matrix of CBVs for the given target.
:param model: An instance of the :py:obj:`everest` model for the target
'''
# Get the info
season = model.season
name = model.name
# We use the LC light curves as CBVs; there aren't
# enough SC ... | def GetTargetCBVs(model):
'''
Returns the design matrix of CBVs for the given target.
:param model: An instance of the :py:obj:`everest` model for the target
'''
# Get the info
season = model.season
name = model.name
# We use the LC light curves as CBVs; there aren't
# enough SC ... | [
"Returns",
"the",
"design",
"matrix",
"of",
"CBVs",
"for",
"the",
"given",
"target",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L1847-L1867 | [
"def",
"GetTargetCBVs",
"(",
"model",
")",
":",
"# Get the info",
"season",
"=",
"model",
".",
"season",
"name",
"=",
"model",
".",
"name",
"# We use the LC light curves as CBVs; there aren't",
"# enough SC light curves to get a good set",
"if",
"name",
".",
"endswith",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | FitCBVs | Fits the CBV design matrix to the de-trended flux of a given target. This
is called internally whenever the user accesses the :py:attr:`fcor`
attribute.
:param model: An instance of the :py:obj:`everest` model for the target | everest/missions/k2/k2.py | def FitCBVs(model):
'''
Fits the CBV design matrix to the de-trended flux of a given target. This
is called internally whenever the user accesses the :py:attr:`fcor`
attribute.
:param model: An instance of the :py:obj:`everest` model for the target
'''
# Get cbvs?
if model.XCBV is Non... | def FitCBVs(model):
'''
Fits the CBV design matrix to the de-trended flux of a given target. This
is called internally whenever the user accesses the :py:attr:`fcor`
attribute.
:param model: An instance of the :py:obj:`everest` model for the target
'''
# Get cbvs?
if model.XCBV is Non... | [
"Fits",
"the",
"CBV",
"design",
"matrix",
"to",
"the",
"de",
"-",
"trended",
"flux",
"of",
"a",
"given",
"target",
".",
"This",
"is",
"called",
"internally",
"whenever",
"the",
"user",
"accesses",
"the",
":",
"py",
":",
"attr",
":",
"fcor",
"attribute",
... | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L1870-L1984 | [
"def",
"FitCBVs",
"(",
"model",
")",
":",
"# Get cbvs?",
"if",
"model",
".",
"XCBV",
"is",
"None",
":",
"GetTargetCBVs",
"(",
"model",
")",
"# The number of CBVs to use",
"ncbv",
"=",
"model",
".",
"cbv_num",
"# Need to treat short and long cadences differently",
"i... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | StatsToCSV | Generate the CSV file used in the search database for the documentation. | everest/missions/k2/k2.py | def StatsToCSV(campaign, model='nPLD'):
'''
Generate the CSV file used in the search database for the documentation.
'''
statsfile = os.path.join(EVEREST_SRC, 'missions', 'k2',
'tables', 'c%02d_%s.cdpp' % (campaign, model))
csvfile = os.path.join(os.path.dirname(EVEREST_... | def StatsToCSV(campaign, model='nPLD'):
'''
Generate the CSV file used in the search database for the documentation.
'''
statsfile = os.path.join(EVEREST_SRC, 'missions', 'k2',
'tables', 'c%02d_%s.cdpp' % (campaign, model))
csvfile = os.path.join(os.path.dirname(EVEREST_... | [
"Generate",
"the",
"CSV",
"file",
"used",
"in",
"the",
"search",
"database",
"for",
"the",
"documentation",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L1987-L2004 | [
"def",
"StatsToCSV",
"(",
"campaign",
",",
"model",
"=",
"'nPLD'",
")",
":",
"statsfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"EVEREST_SRC",
",",
"'missions'",
",",
"'k2'",
",",
"'tables'",
",",
"'c%02d_%s.cdpp'",
"%",
"(",
"campaign",
",",
"model"... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | zset.remove | Remove ``item`` for the :class:`zset` it it exists.
If found it returns the score of the item removed. | stdnet/utils/zset.py | def remove(self, item):
'''Remove ``item`` for the :class:`zset` it it exists.
If found it returns the score of the item removed.'''
score = self._dict.pop(item, None)
if score is not None:
self._sl.remove(score)
return score | def remove(self, item):
'''Remove ``item`` for the :class:`zset` it it exists.
If found it returns the score of the item removed.'''
score = self._dict.pop(item, None)
if score is not None:
self._sl.remove(score)
return score | [
"Remove",
"item",
"for",
"the",
":",
"class",
":",
"zset",
"it",
"it",
"exists",
".",
"If",
"found",
"it",
"returns",
"the",
"score",
"of",
"the",
"item",
"removed",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/utils/zset.py#L52-L58 | [
"def",
"remove",
"(",
"self",
",",
"item",
")",
":",
"score",
"=",
"self",
".",
"_dict",
".",
"pop",
"(",
"item",
",",
"None",
")",
"if",
"score",
"is",
"not",
"None",
":",
"self",
".",
"_sl",
".",
"remove",
"(",
"score",
")",
"return",
"score"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | RedisColumnTS.fields | Return a tuple of ordered fields for this :class:`ColumnTS`. | stdnet/apps/columnts/redis.py | def fields(self):
'''Return a tuple of ordered fields for this :class:`ColumnTS`.'''
key = self.id + ':fields'
encoding = self.client.encoding
return tuple(sorted((f.decode(encoding)
for f in self.client.smembers(key)))) | def fields(self):
'''Return a tuple of ordered fields for this :class:`ColumnTS`.'''
key = self.id + ':fields'
encoding = self.client.encoding
return tuple(sorted((f.decode(encoding)
for f in self.client.smembers(key)))) | [
"Return",
"a",
"tuple",
"of",
"ordered",
"fields",
"for",
"this",
":",
"class",
":",
"ColumnTS",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/apps/columnts/redis.py#L38-L43 | [
"def",
"fields",
"(",
"self",
")",
":",
"key",
"=",
"self",
".",
"id",
"+",
"':fields'",
"encoding",
"=",
"self",
".",
"client",
".",
"encoding",
"return",
"tuple",
"(",
"sorted",
"(",
"(",
"f",
".",
"decode",
"(",
"encoding",
")",
"for",
"f",
"in"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | do_pending_lookups | Handle any pending relations to the sending model.
Sent from class_prepared. | stdnet/odm/related.py | def do_pending_lookups(event, sender, **kwargs):
"""Handle any pending relations to the sending model.
Sent from class_prepared."""
key = (sender._meta.app_label, sender._meta.name)
for callback in pending_lookups.pop(key, []):
callback(sender) | def do_pending_lookups(event, sender, **kwargs):
"""Handle any pending relations to the sending model.
Sent from class_prepared."""
key = (sender._meta.app_label, sender._meta.name)
for callback in pending_lookups.pop(key, []):
callback(sender) | [
"Handle",
"any",
"pending",
"relations",
"to",
"the",
"sending",
"model",
".",
"Sent",
"from",
"class_prepared",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/related.py#L66-L71 | [
"def",
"do_pending_lookups",
"(",
"event",
",",
"sender",
",",
"*",
"*",
"kwargs",
")",
":",
"key",
"=",
"(",
"sender",
".",
"_meta",
".",
"app_label",
",",
"sender",
".",
"_meta",
".",
"name",
")",
"for",
"callback",
"in",
"pending_lookups",
".",
"pop... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Many2ManyThroughModel | Create a Many2Many through model with two foreign key fields and a
CompositeFieldId depending on the two foreign keys. | stdnet/odm/related.py | def Many2ManyThroughModel(field):
'''Create a Many2Many through model with two foreign key fields and a
CompositeFieldId depending on the two foreign keys.'''
from stdnet.odm import ModelType, StdModel, ForeignKey, CompositeIdField
name_model = field.model._meta.name
name_relmodel = field.relmodel.... | def Many2ManyThroughModel(field):
'''Create a Many2Many through model with two foreign key fields and a
CompositeFieldId depending on the two foreign keys.'''
from stdnet.odm import ModelType, StdModel, ForeignKey, CompositeIdField
name_model = field.model._meta.name
name_relmodel = field.relmodel.... | [
"Create",
"a",
"Many2Many",
"through",
"model",
"with",
"two",
"foreign",
"key",
"fields",
"and",
"a",
"CompositeFieldId",
"depending",
"on",
"the",
"two",
"foreign",
"keys",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/related.py#L77-L114 | [
"def",
"Many2ManyThroughModel",
"(",
"field",
")",
":",
"from",
"stdnet",
".",
"odm",
"import",
"ModelType",
",",
"StdModel",
",",
"ForeignKey",
",",
"CompositeIdField",
"name_model",
"=",
"field",
".",
"model",
".",
"_meta",
".",
"name",
"name_relmodel",
"=",... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | makeMany2ManyRelatedManager | formodel is the model which the manager . | stdnet/odm/related.py | def makeMany2ManyRelatedManager(formodel, name_relmodel, name_formodel):
'''formodel is the model which the manager .'''
class _Many2ManyRelatedManager(Many2ManyRelatedManager):
pass
_Many2ManyRelatedManager.formodel = formodel
_Many2ManyRelatedManager.name_relmodel = name_relmodel
... | def makeMany2ManyRelatedManager(formodel, name_relmodel, name_formodel):
'''formodel is the model which the manager .'''
class _Many2ManyRelatedManager(Many2ManyRelatedManager):
pass
_Many2ManyRelatedManager.formodel = formodel
_Many2ManyRelatedManager.name_relmodel = name_relmodel
... | [
"formodel",
"is",
"the",
"model",
"which",
"the",
"manager",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/related.py#L265-L274 | [
"def",
"makeMany2ManyRelatedManager",
"(",
"formodel",
",",
"name_relmodel",
",",
"name_formodel",
")",
":",
"class",
"_Many2ManyRelatedManager",
"(",
"Many2ManyRelatedManager",
")",
":",
"pass",
"_Many2ManyRelatedManager",
".",
"formodel",
"=",
"formodel",
"_Many2ManyRel... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | RelatedManager.session | Override :meth:`Manager.session` so that this
:class:`RelatedManager` can retrieve the session from the
:attr:`related_instance` if available. | stdnet/odm/related.py | def session(self, session=None):
'''Override :meth:`Manager.session` so that this
:class:`RelatedManager` can retrieve the session from the
:attr:`related_instance` if available.
'''
if self.related_instance:
session = self.related_instance.session
# we... | def session(self, session=None):
'''Override :meth:`Manager.session` so that this
:class:`RelatedManager` can retrieve the session from the
:attr:`related_instance` if available.
'''
if self.related_instance:
session = self.related_instance.session
# we... | [
"Override",
":",
"meth",
":",
"Manager",
".",
"session",
"so",
"that",
"this",
":",
"class",
":",
"RelatedManager",
"can",
"retrieve",
"the",
"session",
"from",
"the",
":",
"attr",
":",
"related_instance",
"if",
"available",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/related.py#L176-L187 | [
"def",
"session",
"(",
"self",
",",
"session",
"=",
"None",
")",
":",
"if",
"self",
".",
"related_instance",
":",
"session",
"=",
"self",
".",
"related_instance",
".",
"session",
"# we have a session, we either create a new one return the same session\r",
"if",
"sessi... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Many2ManyRelatedManager.add | Add ``value``, an instance of :attr:`formodel` to the
:attr:`through` model. This method can only be accessed by an instance of the
model for which this related manager is an attribute. | stdnet/odm/related.py | def add(self, value, session=None, **kwargs):
'''Add ``value``, an instance of :attr:`formodel` to the
:attr:`through` model. This method can only be accessed by an instance of the
model for which this related manager is an attribute.'''
s, instance = self.session_instance('add', value, session, **k... | def add(self, value, session=None, **kwargs):
'''Add ``value``, an instance of :attr:`formodel` to the
:attr:`through` model. This method can only be accessed by an instance of the
model for which this related manager is an attribute.'''
s, instance = self.session_instance('add', value, session, **k... | [
"Add",
"value",
"an",
"instance",
"of",
":",
"attr",
":",
"formodel",
"to",
"the",
":",
"attr",
":",
"through",
"model",
".",
"This",
"method",
"can",
"only",
"be",
"accessed",
"by",
"an",
"instance",
"of",
"the",
"model",
"for",
"which",
"this",
"rela... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/related.py#L237-L242 | [
"def",
"add",
"(",
"self",
",",
"value",
",",
"session",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"s",
",",
"instance",
"=",
"self",
".",
"session_instance",
"(",
"'add'",
",",
"value",
",",
"session",
",",
"*",
"*",
"kwargs",
")",
"return",... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Many2ManyRelatedManager.remove | Remove *value*, an instance of ``self.model`` from the set of
elements contained by the field. | stdnet/odm/related.py | def remove(self, value, session=None):
'''Remove *value*, an instance of ``self.model`` from the set of
elements contained by the field.'''
s, instance = self.session_instance('remove', value, session)
# update state so that the instance does look persistent
instance.get_state(iid=i... | def remove(self, value, session=None):
'''Remove *value*, an instance of ``self.model`` from the set of
elements contained by the field.'''
s, instance = self.session_instance('remove', value, session)
# update state so that the instance does look persistent
instance.get_state(iid=i... | [
"Remove",
"*",
"value",
"*",
"an",
"instance",
"of",
"self",
".",
"model",
"from",
"the",
"set",
"of",
"elements",
"contained",
"by",
"the",
"field",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/related.py#L244-L250 | [
"def",
"remove",
"(",
"self",
",",
"value",
",",
"session",
"=",
"None",
")",
":",
"s",
",",
"instance",
"=",
"self",
".",
"session_instance",
"(",
"'remove'",
",",
"value",
",",
"session",
")",
"# update state so that the instance does look persistent\r",
"inst... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | metaphone_processor | Double metaphone word processor. | stdnet/apps/searchengine/processors/__init__.py | def metaphone_processor(words):
'''Double metaphone word processor.'''
for word in words:
for w in double_metaphone(word):
if w:
w = w.strip()
if w:
yield w | def metaphone_processor(words):
'''Double metaphone word processor.'''
for word in words:
for w in double_metaphone(word):
if w:
w = w.strip()
if w:
yield w | [
"Double",
"metaphone",
"word",
"processor",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/apps/searchengine/processors/__init__.py#L18-L25 | [
"def",
"metaphone_processor",
"(",
"words",
")",
":",
"for",
"word",
"in",
"words",
":",
"for",
"w",
"in",
"double_metaphone",
"(",
"word",
")",
":",
"if",
"w",
":",
"w",
"=",
"w",
".",
"strip",
"(",
")",
"if",
"w",
":",
"yield",
"w"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | tolerant_metaphone_processor | Double metaphone word processor slightly modified so that when no
words are returned by the algorithm, the original word is returned. | stdnet/apps/searchengine/processors/__init__.py | def tolerant_metaphone_processor(words):
'''Double metaphone word processor slightly modified so that when no
words are returned by the algorithm, the original word is returned.'''
for word in words:
r = 0
for w in double_metaphone(word):
if w:
w = w.strip()
... | def tolerant_metaphone_processor(words):
'''Double metaphone word processor slightly modified so that when no
words are returned by the algorithm, the original word is returned.'''
for word in words:
r = 0
for w in double_metaphone(word):
if w:
w = w.strip()
... | [
"Double",
"metaphone",
"word",
"processor",
"slightly",
"modified",
"so",
"that",
"when",
"no",
"words",
"are",
"returned",
"by",
"the",
"algorithm",
"the",
"original",
"word",
"is",
"returned",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/apps/searchengine/processors/__init__.py#L28-L40 | [
"def",
"tolerant_metaphone_processor",
"(",
"words",
")",
":",
"for",
"word",
"in",
"words",
":",
"r",
"=",
"0",
"for",
"w",
"in",
"double_metaphone",
"(",
"word",
")",
":",
"if",
"w",
":",
"w",
"=",
"w",
".",
"strip",
"(",
")",
"if",
"w",
":",
"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | stemming_processor | Porter Stemmer word processor | stdnet/apps/searchengine/processors/__init__.py | def stemming_processor(words):
'''Porter Stemmer word processor'''
stem = PorterStemmer().stem
for word in words:
word = stem(word, 0, len(word)-1)
yield word | def stemming_processor(words):
'''Porter Stemmer word processor'''
stem = PorterStemmer().stem
for word in words:
word = stem(word, 0, len(word)-1)
yield word | [
"Porter",
"Stemmer",
"word",
"processor"
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/apps/searchengine/processors/__init__.py#L43-L48 | [
"def",
"stemming_processor",
"(",
"words",
")",
":",
"stem",
"=",
"PorterStemmer",
"(",
")",
".",
"stem",
"for",
"word",
"in",
"words",
":",
"word",
"=",
"stem",
"(",
"word",
",",
"0",
",",
"len",
"(",
"word",
")",
"-",
"1",
")",
"yield",
"word"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Pool | Chooses between the different pools.
If ``pool == 'AnyPool'``, chooses based on availability. | everest/pool.py | def Pool(pool='AnyPool', **kwargs):
'''
Chooses between the different pools.
If ``pool == 'AnyPool'``, chooses based on availability.
'''
if pool == 'MPIPool':
return MPIPool(**kwargs)
elif pool == 'MultiPool':
return MultiPool(**kwargs)
elif pool == 'SerialPool':
r... | def Pool(pool='AnyPool', **kwargs):
'''
Chooses between the different pools.
If ``pool == 'AnyPool'``, chooses based on availability.
'''
if pool == 'MPIPool':
return MPIPool(**kwargs)
elif pool == 'MultiPool':
return MultiPool(**kwargs)
elif pool == 'SerialPool':
r... | [
"Chooses",
"between",
"the",
"different",
"pools",
".",
"If",
"pool",
"==",
"AnyPool",
"chooses",
"based",
"on",
"availability",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/pool.py#L504-L525 | [
"def",
"Pool",
"(",
"pool",
"=",
"'AnyPool'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"pool",
"==",
"'MPIPool'",
":",
"return",
"MPIPool",
"(",
"*",
"*",
"kwargs",
")",
"elif",
"pool",
"==",
"'MultiPool'",
":",
"return",
"MultiPool",
"(",
"*",
"*",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | MPIPool.wait | If this isn't the master process, wait for instructions. | everest/pool.py | def wait(self):
"""
If this isn't the master process, wait for instructions.
"""
if self.is_master():
raise RuntimeError("Master node told to await jobs.")
status = MPI.Status()
while True:
# Event loop.
# Sit here and await instruct... | def wait(self):
"""
If this isn't the master process, wait for instructions.
"""
if self.is_master():
raise RuntimeError("Master node told to await jobs.")
status = MPI.Status()
while True:
# Event loop.
# Sit here and await instruct... | [
"If",
"this",
"isn",
"t",
"the",
"master",
"process",
"wait",
"for",
"instructions",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/pool.py#L220-L269 | [
"def",
"wait",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_master",
"(",
")",
":",
"raise",
"RuntimeError",
"(",
"\"Master node told to await jobs.\"",
")",
"status",
"=",
"MPI",
".",
"Status",
"(",
")",
"while",
"True",
":",
"# Event loop.",
"# Sit here a... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | MPIPool.map | Like the built-in :py:func:`map` function, apply a function to all
of the values in a list and return the list of results.
:param function:
The function to apply to the list.
:param tasks:
The list of elements. | everest/pool.py | def map(self, function, tasks):
"""
Like the built-in :py:func:`map` function, apply a function to all
of the values in a list and return the list of results.
:param function:
The function to apply to the list.
:param tasks:
The list of elements.
... | def map(self, function, tasks):
"""
Like the built-in :py:func:`map` function, apply a function to all
of the values in a list and return the list of results.
:param function:
The function to apply to the list.
:param tasks:
The list of elements.
... | [
"Like",
"the",
"built",
"-",
"in",
":",
"py",
":",
"func",
":",
"map",
"function",
"apply",
"a",
"function",
"to",
"all",
"of",
"the",
"values",
"in",
"a",
"list",
"and",
"return",
"the",
"list",
"of",
"results",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/pool.py#L271-L380 | [
"def",
"map",
"(",
"self",
",",
"function",
",",
"tasks",
")",
":",
"ntask",
"=",
"len",
"(",
"tasks",
")",
"# If not the master just wait for instructions.",
"if",
"not",
"self",
".",
"is_master",
"(",
")",
":",
"self",
".",
"wait",
"(",
")",
"return",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | MPIPool.close | Just send a message off to all the pool members which contains
the special :class:`_close_pool_message` sentinel. | everest/pool.py | def close(self):
"""
Just send a message off to all the pool members which contains
the special :class:`_close_pool_message` sentinel.
"""
if self.is_master():
for i in range(self.size):
self.comm.isend(_close_pool_message(), dest=i + 1) | def close(self):
"""
Just send a message off to all the pool members which contains
the special :class:`_close_pool_message` sentinel.
"""
if self.is_master():
for i in range(self.size):
self.comm.isend(_close_pool_message(), dest=i + 1) | [
"Just",
"send",
"a",
"message",
"off",
"to",
"all",
"the",
"pool",
"members",
"which",
"contains",
"the",
"special",
":",
"class",
":",
"_close_pool_message",
"sentinel",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/pool.py#L388-L396 | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_master",
"(",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"size",
")",
":",
"self",
".",
"comm",
".",
"isend",
"(",
"_close_pool_message",
"(",
")",
",",
"dest",
"=",
"i",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | commit_when_no_transaction | Decorator for committing changes when the instance session is
not in a transaction. | stdnet/odm/struct.py | def commit_when_no_transaction(f):
'''Decorator for committing changes when the instance session is
not in a transaction.'''
def _(self, *args, **kwargs):
r = f(self, *args, **kwargs)
return self.session.add(self) if self.session is not None else r
_.__name__ = f.__name__
_.__doc_... | def commit_when_no_transaction(f):
'''Decorator for committing changes when the instance session is
not in a transaction.'''
def _(self, *args, **kwargs):
r = f(self, *args, **kwargs)
return self.session.add(self) if self.session is not None else r
_.__name__ = f.__name__
_.__doc_... | [
"Decorator",
"for",
"committing",
"changes",
"when",
"the",
"instance",
"session",
"is",
"not",
"in",
"a",
"transaction",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L32-L40 | [
"def",
"commit_when_no_transaction",
"(",
"f",
")",
":",
"def",
"_",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"r",
"=",
"f",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"session",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Structure.backend | Returns the :class:`stdnet.BackendStructure`. | stdnet/odm/struct.py | def backend(self):
'''Returns the :class:`stdnet.BackendStructure`.
'''
session = self.session
if session is not None:
if self._field:
return session.model(self._field.model).backend
else:
return session.model(self).backend | def backend(self):
'''Returns the :class:`stdnet.BackendStructure`.
'''
session = self.session
if session is not None:
if self._field:
return session.model(self._field.model).backend
else:
return session.model(self).backend | [
"Returns",
"the",
":",
"class",
":",
"stdnet",
".",
"BackendStructure",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L257-L265 | [
"def",
"backend",
"(",
"self",
")",
":",
"session",
"=",
"self",
".",
"session",
"if",
"session",
"is",
"not",
"None",
":",
"if",
"self",
".",
"_field",
":",
"return",
"session",
".",
"model",
"(",
"self",
".",
"_field",
".",
"model",
")",
".",
"ba... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Structure.read_backend | Returns the :class:`stdnet.BackendStructure`. | stdnet/odm/struct.py | def read_backend(self):
'''Returns the :class:`stdnet.BackendStructure`.
'''
session = self.session
if session is not None:
if self._field:
return session.model(self._field.model).read_backend
else:
return session.model(self... | def read_backend(self):
'''Returns the :class:`stdnet.BackendStructure`.
'''
session = self.session
if session is not None:
if self._field:
return session.model(self._field.model).read_backend
else:
return session.model(self... | [
"Returns",
"the",
":",
"class",
":",
"stdnet",
".",
"BackendStructure",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L268-L276 | [
"def",
"read_backend",
"(",
"self",
")",
":",
"session",
"=",
"self",
".",
"session",
"if",
"session",
"is",
"not",
"None",
":",
"if",
"self",
".",
"_field",
":",
"return",
"session",
".",
"model",
"(",
"self",
".",
"_field",
".",
"model",
")",
".",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Structure.size | Number of elements in the :class:`Structure`. | stdnet/odm/struct.py | def size(self):
'''Number of elements in the :class:`Structure`.'''
if self.cache.cache is None:
return self.read_backend_structure().size()
else:
return len(self.cache.cache) | def size(self):
'''Number of elements in the :class:`Structure`.'''
if self.cache.cache is None:
return self.read_backend_structure().size()
else:
return len(self.cache.cache) | [
"Number",
"of",
"elements",
"in",
"the",
":",
"class",
":",
"Structure",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L288-L293 | [
"def",
"size",
"(",
"self",
")",
":",
"if",
"self",
".",
"cache",
".",
"cache",
"is",
"None",
":",
"return",
"self",
".",
"read_backend_structure",
"(",
")",
".",
"size",
"(",
")",
"else",
":",
"return",
"len",
"(",
"self",
".",
"cache",
".",
"cach... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.