repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
rodluger/everest
everest/detrender.py
pPLD.cross_validate
def cross_validate(self, ax): ''' Performs the cross-validation step. ''' # The CDPP to beat cdpp_opt = self.get_cdpp_arr() # Loop over all chunks for b, brkpt in enumerate(self.breakpoints): log.info("Cross-validating chunk %d/%d..." % ...
python
def cross_validate(self, ax): ''' Performs the cross-validation step. ''' # The CDPP to beat cdpp_opt = self.get_cdpp_arr() # Loop over all chunks for b, brkpt in enumerate(self.breakpoints): log.info("Cross-validating chunk %d/%d..." % ...
[ "def", "cross_validate", "(", "self", ",", "ax", ")", ":", "# The CDPP to beat", "cdpp_opt", "=", "self", ".", "get_cdpp_arr", "(", ")", "# Loop over all chunks", "for", "b", ",", "brkpt", "in", "enumerate", "(", "self", ".", "breakpoints", ")", ":", "log", ...
Performs the cross-validation step.
[ "Performs", "the", "cross", "-", "validation", "step", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/detrender.py#L1571-L1676
train
rodluger/everest
everest/detrender.py
pPLD.validation_scatter
def validation_scatter(self, log_lam, b, masks, pre_v, gp, flux, time, med): ''' Computes the scatter in the validation set. ''' # Update the lambda matrix self.lam[b] = 10 ** log_lam # Validation set scatter scatter = [None for i in ...
python
def validation_scatter(self, log_lam, b, masks, pre_v, gp, flux, time, med): ''' Computes the scatter in the validation set. ''' # Update the lambda matrix self.lam[b] = 10 ** log_lam # Validation set scatter scatter = [None for i in ...
[ "def", "validation_scatter", "(", "self", ",", "log_lam", ",", "b", ",", "masks", ",", "pre_v", ",", "gp", ",", "flux", ",", "time", ",", "med", ")", ":", "# Update the lambda matrix", "self", ".", "lam", "[", "b", "]", "=", "10", "**", "log_lam", "#...
Computes the scatter in the validation set.
[ "Computes", "the", "scatter", "in", "the", "validation", "set", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/detrender.py#L1678-L1703
train
lsbardel/python-stdnet
stdnet/utils/populate.py
populate
def populate(datatype='string', size=10, start=None, end=None, converter=None, choice_from=None, **kwargs): '''Utility function for populating lists with random data. Useful for populating database with data for fuzzy testing. Supported data-types * *string* For example:: populat...
python
def populate(datatype='string', size=10, start=None, end=None, converter=None, choice_from=None, **kwargs): '''Utility function for populating lists with random data. Useful for populating database with data for fuzzy testing. Supported data-types * *string* For example:: populat...
[ "def", "populate", "(", "datatype", "=", "'string'", ",", "size", "=", "10", ",", "start", "=", "None", ",", "end", "=", "None", ",", "converter", "=", "None", ",", "choice_from", "=", "None", ",", "*", "*", "kwargs", ")", ":", "data", "=", "[", ...
Utility function for populating lists with random data. Useful for populating database with data for fuzzy testing. Supported data-types * *string* For example:: populate('string',100, min_len=3, max_len=10) create a 100 elements list with random strings with random length between 3 and...
[ "Utility", "function", "for", "populating", "lists", "with", "random", "data", ".", "Useful", "for", "populating", "database", "with", "data", "for", "fuzzy", "testing", ".", "Supported", "data", "-", "types", "*", "*", "string", "*", "For", "example", "::",...
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/utils/populate.py#L16-L84
train
rodluger/everest
everest/search.py
Search
def Search(star, pos_tol=2.5, neg_tol=50., **ps_kwargs): ''' NOTE: `pos_tol` is the positive (i.e., above the median) outlier tolerance in standard deviations. NOTE: `neg_tol` is the negative (i.e., below the median) outlier tolerance in standard deviations. ''' # Smooth the light curve ...
python
def Search(star, pos_tol=2.5, neg_tol=50., **ps_kwargs): ''' NOTE: `pos_tol` is the positive (i.e., above the median) outlier tolerance in standard deviations. NOTE: `neg_tol` is the negative (i.e., below the median) outlier tolerance in standard deviations. ''' # Smooth the light curve ...
[ "def", "Search", "(", "star", ",", "pos_tol", "=", "2.5", ",", "neg_tol", "=", "50.", ",", "*", "*", "ps_kwargs", ")", ":", "# Smooth the light curve", "t", "=", "np", ".", "delete", "(", "star", ".", "time", ",", "np", ".", "concatenate", "(", "[", ...
NOTE: `pos_tol` is the positive (i.e., above the median) outlier tolerance in standard deviations. NOTE: `neg_tol` is the negative (i.e., below the median) outlier tolerance in standard deviations.
[ "NOTE", ":", "pos_tol", "is", "the", "positive", "(", "i", ".", "e", ".", "above", "the", "median", ")", "outlier", "tolerance", "in", "standard", "deviations", ".", "NOTE", ":", "neg_tol", "is", "the", "negative", "(", "i", ".", "e", ".", "below", "...
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/search.py#L29-L131
train
lsbardel/python-stdnet
stdnet/odm/session.py
SessionModel.iterdirty
def iterdirty(self): '''Ordered iterator over dirty elements.''' return iter(chain(itervalues(self._new), itervalues(self._modified)))
python
def iterdirty(self): '''Ordered iterator over dirty elements.''' return iter(chain(itervalues(self._new), itervalues(self._modified)))
[ "def", "iterdirty", "(", "self", ")", ":", "return", "iter", "(", "chain", "(", "itervalues", "(", "self", ".", "_new", ")", ",", "itervalues", "(", "self", ".", "_modified", ")", ")", ")" ]
Ordered iterator over dirty elements.
[ "Ordered", "iterator", "over", "dirty", "elements", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L108-L110
train
lsbardel/python-stdnet
stdnet/odm/session.py
SessionModel.add
def add(self, instance, modified=True, persistent=None, force_update=False): '''Add a new instance to this :class:`SessionModel`. :param modified: Optional flag indicating if the ``instance`` has been modified. By default its value is ``True``. :param force_update: if ``instance`` is pers...
python
def add(self, instance, modified=True, persistent=None, force_update=False): '''Add a new instance to this :class:`SessionModel`. :param modified: Optional flag indicating if the ``instance`` has been modified. By default its value is ``True``. :param force_update: if ``instance`` is pers...
[ "def", "add", "(", "self", ",", "instance", ",", "modified", "=", "True", ",", "persistent", "=", "None", ",", "force_update", "=", "False", ")", ":", "if", "instance", ".", "_meta", ".", "type", "==", "'structure'", ":", "return", "self", ".", "_add_s...
Add a new instance to this :class:`SessionModel`. :param modified: Optional flag indicating if the ``instance`` has been modified. By default its value is ``True``. :param force_update: if ``instance`` is persistent, it forces an update of the data rather than a full replacement. This is used by the ...
[ "Add", "a", "new", "instance", "to", "this", ":", "class", ":", "SessionModel", ".", ":", "param", "modified", ":", "Optional", "flag", "indicating", "if", "the", "instance", "has", "been", "modified", ".", "By", "default", "its", "value", "is", "True", ...
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L119-L152
train
lsbardel/python-stdnet
stdnet/odm/session.py
SessionModel.delete
def delete(self, instance, session): '''delete an *instance*''' if instance._meta.type == 'structure': return self._delete_structure(instance) inst = self.pop(instance) instance = inst if inst is not None else instance if instance is not None: state...
python
def delete(self, instance, session): '''delete an *instance*''' if instance._meta.type == 'structure': return self._delete_structure(instance) inst = self.pop(instance) instance = inst if inst is not None else instance if instance is not None: state...
[ "def", "delete", "(", "self", ",", "instance", ",", "session", ")", ":", "if", "instance", ".", "_meta", ".", "type", "==", "'structure'", ":", "return", "self", ".", "_delete_structure", "(", "instance", ")", "inst", "=", "self", ".", "pop", "(", "ins...
delete an *instance*
[ "delete", "an", "*", "instance", "*" ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L154-L168
train
lsbardel/python-stdnet
stdnet/odm/session.py
SessionModel.pop
def pop(self, instance): '''Remove ``instance`` from the :class:`SessionModel`. Instance could be a :class:`Model` or an id. :parameter instance: a :class:`Model` or an ``id``. :rtype: the :class:`Model` removed from session or ``None`` if it was not in the session. ''' if isinstance(instan...
python
def pop(self, instance): '''Remove ``instance`` from the :class:`SessionModel`. Instance could be a :class:`Model` or an id. :parameter instance: a :class:`Model` or an ``id``. :rtype: the :class:`Model` removed from session or ``None`` if it was not in the session. ''' if isinstance(instan...
[ "def", "pop", "(", "self", ",", "instance", ")", ":", "if", "isinstance", "(", "instance", ",", "self", ".", "model", ")", ":", "iid", "=", "instance", ".", "get_state", "(", ")", ".", "iid", "else", ":", "iid", "=", "instance", "instance", "=", "N...
Remove ``instance`` from the :class:`SessionModel`. Instance could be a :class:`Model` or an id. :parameter instance: a :class:`Model` or an ``id``. :rtype: the :class:`Model` removed from session or ``None`` if it was not in the session.
[ "Remove", "instance", "from", "the", ":", "class", ":", "SessionModel", ".", "Instance", "could", "be", "a", ":", "class", ":", "Model", "or", "an", "id", ".", ":", "parameter", "instance", ":", "a", ":", "class", ":", "Model", "or", "an", "id", ".",...
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L170-L190
train
lsbardel/python-stdnet
stdnet/odm/session.py
SessionModel.expunge
def expunge(self, instance): '''Remove *instance* from the :class:`Session`. Instance could be a :class:`Model` or an id. :parameter instance: a :class:`Model` or an *id* :rtype: the :class:`Model` removed from session or ``None`` if it was not in the session. ''' instance = self.pop(instan...
python
def expunge(self, instance): '''Remove *instance* from the :class:`Session`. Instance could be a :class:`Model` or an id. :parameter instance: a :class:`Model` or an *id* :rtype: the :class:`Model` removed from session or ``None`` if it was not in the session. ''' instance = self.pop(instan...
[ "def", "expunge", "(", "self", ",", "instance", ")", ":", "instance", "=", "self", ".", "pop", "(", "instance", ")", "instance", ".", "session", "=", "None", "return", "instance" ]
Remove *instance* from the :class:`Session`. Instance could be a :class:`Model` or an id. :parameter instance: a :class:`Model` or an *id* :rtype: the :class:`Model` removed from session or ``None`` if it was not in the session.
[ "Remove", "*", "instance", "*", "from", "the", ":", "class", ":", "Session", ".", "Instance", "could", "be", "a", ":", "class", ":", "Model", "or", "an", "id", ".", ":", "parameter", "instance", ":", "a", ":", "class", ":", "Model", "or", "an", "*"...
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L192-L202
train
lsbardel/python-stdnet
stdnet/odm/session.py
SessionModel.post_commit
def post_commit(self, results): '''\ Process results after a commit. :parameter results: iterator over :class:`stdnet.instance_session_result` items. :rtype: a two elements tuple containing a list of instances saved and a list of ids of instances deleted.''' tpy = self._meta.pk_to_pytho...
python
def post_commit(self, results): '''\ Process results after a commit. :parameter results: iterator over :class:`stdnet.instance_session_result` items. :rtype: a two elements tuple containing a list of instances saved and a list of ids of instances deleted.''' tpy = self._meta.pk_to_pytho...
[ "def", "post_commit", "(", "self", ",", "results", ")", ":", "tpy", "=", "self", ".", "_meta", ".", "pk_to_python", "instances", "=", "[", "]", "deleted", "=", "[", "]", "errors", "=", "[", "]", "# The length of results must be the same as the length of\r", "#...
\ Process results after a commit. :parameter results: iterator over :class:`stdnet.instance_session_result` items. :rtype: a two elements tuple containing a list of instances saved and a list of ids of instances deleted.
[ "\\", "Process", "results", "after", "a", "commit", ".", ":", "parameter", "results", ":", "iterator", "over", ":", "class", ":", "stdnet", ".", "instance_session_result", "items", ".", ":", "rtype", ":", "a", "two", "elements", "tuple", "containing", "a", ...
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L204-L238
train
lsbardel/python-stdnet
stdnet/odm/session.py
Transaction.commit
def commit(self, callback=None): '''Close the transaction and commit session to the backend.''' if self.executed: raise InvalidTransaction('Invalid operation. ' 'Transaction already executed.') session = self.session self.session = N...
python
def commit(self, callback=None): '''Close the transaction and commit session to the backend.''' if self.executed: raise InvalidTransaction('Invalid operation. ' 'Transaction already executed.') session = self.session self.session = N...
[ "def", "commit", "(", "self", ",", "callback", "=", "None", ")", ":", "if", "self", ".", "executed", ":", "raise", "InvalidTransaction", "(", "'Invalid operation. '", "'Transaction already executed.'", ")", "session", "=", "self", ".", "session", "self", ".", ...
Close the transaction and commit session to the backend.
[ "Close", "the", "transaction", "and", "commit", "session", "to", "the", "backend", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L427-L435
train
lsbardel/python-stdnet
stdnet/odm/session.py
Session.dirty
def dirty(self): '''The set of instances in this :class:`Session` which have been modified.''' return frozenset(chain(*tuple((sm.dirty for sm in itervalues(self._models)))))
python
def dirty(self): '''The set of instances in this :class:`Session` which have been modified.''' return frozenset(chain(*tuple((sm.dirty for sm in itervalues(self._models)))))
[ "def", "dirty", "(", "self", ")", ":", "return", "frozenset", "(", "chain", "(", "*", "tuple", "(", "(", "sm", ".", "dirty", "for", "sm", "in", "itervalues", "(", "self", ".", "_models", ")", ")", ")", ")", ")" ]
The set of instances in this :class:`Session` which have been modified.
[ "The", "set", "of", "instances", "in", "this", ":", "class", ":", "Session", "which", "have", "been", "modified", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L547-L551
train
lsbardel/python-stdnet
stdnet/odm/session.py
Session.begin
def begin(self, **options): '''Begin a new :class:`Transaction`. If this :class:`Session` is already in a :ref:`transactional state <transactional-state>`, an error will occur. It returns the :attr:`transaction` attribute. This method is mostly used within a ``with`` statement block:: with session....
python
def begin(self, **options): '''Begin a new :class:`Transaction`. If this :class:`Session` is already in a :ref:`transactional state <transactional-state>`, an error will occur. It returns the :attr:`transaction` attribute. This method is mostly used within a ``with`` statement block:: with session....
[ "def", "begin", "(", "self", ",", "*", "*", "options", ")", ":", "if", "self", ".", "transaction", "is", "not", "None", ":", "raise", "InvalidTransaction", "(", "\"A transaction is already begun.\"", ")", "else", ":", "self", ".", "transaction", "=", "Transa...
Begin a new :class:`Transaction`. If this :class:`Session` is already in a :ref:`transactional state <transactional-state>`, an error will occur. It returns the :attr:`transaction` attribute. This method is mostly used within a ``with`` statement block:: with session.begin() as t: t.add(...) ...
[ "Begin", "a", "new", ":", "class", ":", "Transaction", ".", "If", "this", ":", "class", ":", "Session", "is", "already", "in", "a", ":", "ref", ":", "transactional", "state", "<transactional", "-", "state", ">", "an", "error", "will", "occur", ".", "It...
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L553-L577
train
lsbardel/python-stdnet
stdnet/odm/session.py
Session.query
def query(self, model, **kwargs): '''Create a new :class:`Query` for *model*.''' sm = self.model(model) query_class = sm.manager.query_class or Query return query_class(sm._meta, self, **kwargs)
python
def query(self, model, **kwargs): '''Create a new :class:`Query` for *model*.''' sm = self.model(model) query_class = sm.manager.query_class or Query return query_class(sm._meta, self, **kwargs)
[ "def", "query", "(", "self", ",", "model", ",", "*", "*", "kwargs", ")", ":", "sm", "=", "self", ".", "model", "(", "model", ")", "query_class", "=", "sm", ".", "manager", ".", "query_class", "or", "Query", "return", "query_class", "(", "sm", ".", ...
Create a new :class:`Query` for *model*.
[ "Create", "a", "new", ":", "class", ":", "Query", "for", "*", "model", "*", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L590-L594
train
lsbardel/python-stdnet
stdnet/odm/session.py
Session.update_or_create
def update_or_create(self, model, **kwargs): '''Update or create a new instance of ``model``. This method can raise an exception if the ``kwargs`` dictionary contains field data that does not validate. :param model: a :class:`StdModel` :param kwargs: dictionary of parame...
python
def update_or_create(self, model, **kwargs): '''Update or create a new instance of ``model``. This method can raise an exception if the ``kwargs`` dictionary contains field data that does not validate. :param model: a :class:`StdModel` :param kwargs: dictionary of parame...
[ "def", "update_or_create", "(", "self", ",", "model", ",", "*", "*", "kwargs", ")", ":", "backend", "=", "self", ".", "model", "(", "model", ")", ".", "backend", "return", "backend", ".", "execute", "(", "self", ".", "_update_or_create", "(", "model", ...
Update or create a new instance of ``model``. This method can raise an exception if the ``kwargs`` dictionary contains field data that does not validate. :param model: a :class:`StdModel` :param kwargs: dictionary of parameters. :returns: A two elements tuple containing ...
[ "Update", "or", "create", "a", "new", "instance", "of", "model", ".", "This", "method", "can", "raise", "an", "exception", "if", "the", "kwargs", "dictionary", "contains", "field", "data", "that", "does", "not", "validate", ".", ":", "param", "model", ":",...
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L600-L612
train
lsbardel/python-stdnet
stdnet/odm/session.py
Session.add
def add(self, instance, modified=True, **params): '''Add an ``instance`` to the session. If the session is not in a :ref:`transactional state <transactional-state>`, this operation commits changes to the back-end server immediately. :parameter instance: a :class:`Model` ...
python
def add(self, instance, modified=True, **params): '''Add an ``instance`` to the session. If the session is not in a :ref:`transactional state <transactional-state>`, this operation commits changes to the back-end server immediately. :parameter instance: a :class:`Model` ...
[ "def", "add", "(", "self", ",", "instance", ",", "modified", "=", "True", ",", "*", "*", "params", ")", ":", "sm", "=", "self", ".", "model", "(", "instance", ")", "instance", ".", "session", "=", "self", "o", "=", "sm", ".", "add", "(", "instanc...
Add an ``instance`` to the session. If the session is not in a :ref:`transactional state <transactional-state>`, this operation commits changes to the back-end server immediately. :parameter instance: a :class:`Model` instance. It must be registered with the :attr:`r...
[ "Add", "an", "instance", "to", "the", "session", ".", "If", "the", "session", "is", "not", "in", "a", ":", "ref", ":", "transactional", "state", "<transactional", "-", "state", ">", "this", "operation", "commits", "changes", "to", "the", "back", "-", "en...
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L614-L638
train
lsbardel/python-stdnet
stdnet/odm/session.py
Session.delete
def delete(self, instance_or_query): '''Delete an ``instance`` or a ``query``. Adds ``instance_or_query`` to this :class:`Session` list of data to be deleted. If the session is not in a :ref:`transactional state <transactional-state>`, this operation commits changes to the...
python
def delete(self, instance_or_query): '''Delete an ``instance`` or a ``query``. Adds ``instance_or_query`` to this :class:`Session` list of data to be deleted. If the session is not in a :ref:`transactional state <transactional-state>`, this operation commits changes to the...
[ "def", "delete", "(", "self", ",", "instance_or_query", ")", ":", "sm", "=", "self", ".", "model", "(", "instance_or_query", ")", "# not an instance of a Model. Assume it is a query.\r", "if", "is_query", "(", "instance_or_query", ")", ":", "if", "instance_or_query", ...
Delete an ``instance`` or a ``query``. Adds ``instance_or_query`` to this :class:`Session` list of data to be deleted. If the session is not in a :ref:`transactional state <transactional-state>`, this operation commits changes to the backend server immediately. :paramete...
[ "Delete", "an", "instance", "or", "a", "query", ".", "Adds", "instance_or_query", "to", "this", ":", "class", ":", "Session", "list", "of", "data", "to", "be", "deleted", ".", "If", "the", "session", "is", "not", "in", "a", ":", "ref", ":", "transactio...
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L640-L664
train
lsbardel/python-stdnet
stdnet/odm/session.py
Session.model
def model(self, model, create=True): '''Returns the :class:`SessionModel` for ``model`` which can be :class:`Model`, or a :class:`MetaClass`, or an instance of :class:`Model`.''' manager = self.manager(model) sm = self._models.get(manager) if sm is None and create: sm ...
python
def model(self, model, create=True): '''Returns the :class:`SessionModel` for ``model`` which can be :class:`Model`, or a :class:`MetaClass`, or an instance of :class:`Model`.''' manager = self.manager(model) sm = self._models.get(manager) if sm is None and create: sm ...
[ "def", "model", "(", "self", ",", "model", ",", "create", "=", "True", ")", ":", "manager", "=", "self", ".", "manager", "(", "model", ")", "sm", "=", "self", ".", "_models", ".", "get", "(", "manager", ")", "if", "sm", "is", "None", "and", "crea...
Returns the :class:`SessionModel` for ``model`` which can be :class:`Model`, or a :class:`MetaClass`, or an instance of :class:`Model`.
[ "Returns", "the", ":", "class", ":", "SessionModel", "for", "model", "which", "can", "be", ":", "class", ":", "Model", "or", "a", ":", "class", ":", "MetaClass", "or", "an", "instance", "of", ":", "class", ":", "Model", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L684-L693
train
lsbardel/python-stdnet
stdnet/odm/session.py
Session.expunge
def expunge(self, instance=None): '''Remove ``instance`` from this :class:`Session`. If ``instance`` is not given, it removes all instances from this :class:`Session`.''' if instance is not None: sm = self._models.get(instance._meta) if sm: return sm.expunge...
python
def expunge(self, instance=None): '''Remove ``instance`` from this :class:`Session`. If ``instance`` is not given, it removes all instances from this :class:`Session`.''' if instance is not None: sm = self._models.get(instance._meta) if sm: return sm.expunge...
[ "def", "expunge", "(", "self", ",", "instance", "=", "None", ")", ":", "if", "instance", "is", "not", "None", ":", "sm", "=", "self", ".", "_models", ".", "get", "(", "instance", ".", "_meta", ")", "if", "sm", ":", "return", "sm", ".", "expunge", ...
Remove ``instance`` from this :class:`Session`. If ``instance`` is not given, it removes all instances from this :class:`Session`.
[ "Remove", "instance", "from", "this", ":", "class", ":", "Session", ".", "If", "instance", "is", "not", "given", "it", "removes", "all", "instances", "from", "this", ":", "class", ":", "Session", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L695-L703
train
lsbardel/python-stdnet
stdnet/odm/session.py
Session.manager
def manager(self, model): '''Retrieve the :class:`Manager` for ``model`` which can be any of the values valid for the :meth:`model` method.''' try: return self.router[model] except KeyError: meta = getattr(model, '_meta', model) if meta.type == 'structu...
python
def manager(self, model): '''Retrieve the :class:`Manager` for ``model`` which can be any of the values valid for the :meth:`model` method.''' try: return self.router[model] except KeyError: meta = getattr(model, '_meta', model) if meta.type == 'structu...
[ "def", "manager", "(", "self", ",", "model", ")", ":", "try", ":", "return", "self", ".", "router", "[", "model", "]", "except", "KeyError", ":", "meta", "=", "getattr", "(", "model", ",", "'_meta'", ",", "model", ")", "if", "meta", ".", "type", "=...
Retrieve the :class:`Manager` for ``model`` which can be any of the values valid for the :meth:`model` method.
[ "Retrieve", "the", ":", "class", ":", "Manager", "for", "model", "which", "can", "be", "any", "of", "the", "values", "valid", "for", "the", ":", "meth", ":", "model", "method", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L705-L722
train
lsbardel/python-stdnet
stdnet/odm/session.py
Manager.new
def new(self, *args, **kwargs): '''Create a new instance of :attr:`model` and commit it to the backend server. This a shortcut method for the more verbose:: instance = manager.session().add(MyModel(**kwargs)) ''' return self.session().add(self.model(*args, **kwargs))
python
def new(self, *args, **kwargs): '''Create a new instance of :attr:`model` and commit it to the backend server. This a shortcut method for the more verbose:: instance = manager.session().add(MyModel(**kwargs)) ''' return self.session().add(self.model(*args, **kwargs))
[ "def", "new", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "session", "(", ")", ".", "add", "(", "self", ".", "model", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")" ]
Create a new instance of :attr:`model` and commit it to the backend server. This a shortcut method for the more verbose:: instance = manager.session().add(MyModel(**kwargs))
[ "Create", "a", "new", "instance", "of", ":", "attr", ":", "model", "and", "commit", "it", "to", "the", "backend", "server", ".", "This", "a", "shortcut", "method", "for", "the", "more", "verbose", "::", "instance", "=", "manager", ".", "session", "()", ...
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L924-L930
train
lsbardel/python-stdnet
stdnet/odm/session.py
Manager.query
def query(self, session=None): '''Returns a new :class:`Query` for :attr:`Manager.model`.''' if session is None or session.router is not self.router: session = self.session() return session.query(self.model)
python
def query(self, session=None): '''Returns a new :class:`Query` for :attr:`Manager.model`.''' if session is None or session.router is not self.router: session = self.session() return session.query(self.model)
[ "def", "query", "(", "self", ",", "session", "=", "None", ")", ":", "if", "session", "is", "None", "or", "session", ".", "router", "is", "not", "self", ".", "router", ":", "session", "=", "self", ".", "session", "(", ")", "return", "session", ".", ...
Returns a new :class:`Query` for :attr:`Manager.model`.
[ "Returns", "a", "new", ":", "class", ":", "Query", "for", ":", "attr", ":", "Manager", ".", "model", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L957-L961
train
lsbardel/python-stdnet
stdnet/odm/session.py
Manager.search
def search(self, text, lookup=None): '''Returns a new :class:`Query` for :attr:`Manager.model` with a full text search value.''' return self.query().search(text, lookup=lookup)
python
def search(self, text, lookup=None): '''Returns a new :class:`Query` for :attr:`Manager.model` with a full text search value.''' return self.query().search(text, lookup=lookup)
[ "def", "search", "(", "self", ",", "text", ",", "lookup", "=", "None", ")", ":", "return", "self", ".", "query", "(", ")", ".", "search", "(", "text", ",", "lookup", "=", "lookup", ")" ]
Returns a new :class:`Query` for :attr:`Manager.model` with a full text search value.
[ "Returns", "a", "new", ":", "class", ":", "Query", "for", ":", "attr", ":", "Manager", ".", "model", "with", "a", "full", "text", "search", "value", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/session.py#L977-L980
train
lsbardel/python-stdnet
stdnet/backends/redisb/__init__.py
pairs_to_dict
def pairs_to_dict(response, encoding): "Create a dict given a list of key/value pairs" it = iter(response) return dict(((k.decode(encoding), v) for k, v in zip(it, it)))
python
def pairs_to_dict(response, encoding): "Create a dict given a list of key/value pairs" it = iter(response) return dict(((k.decode(encoding), v) for k, v in zip(it, it)))
[ "def", "pairs_to_dict", "(", "response", ",", "encoding", ")", ":", "it", "=", "iter", "(", "response", ")", "return", "dict", "(", "(", "(", "k", ".", "decode", "(", "encoding", ")", ",", "v", ")", "for", "k", ",", "v", "in", "zip", "(", "it", ...
Create a dict given a list of key/value pairs
[ "Create", "a", "dict", "given", "a", "list", "of", "key", "/", "value", "pairs" ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L36-L39
train
lsbardel/python-stdnet
stdnet/backends/redisb/__init__.py
odmrun.load_related
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...
python
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", ")", ":", "field", "=", "meta", ".", "dfields", "[", "fname", "]", "if", "field", "in", "meta", ".", "multifields", ":", "fmeta", "=", "field"...
Parse data for related objects.
[ "Parse", "data", "for", "related", "objects", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L107-L121
train
lsbardel/python-stdnet
stdnet/backends/redisb/__init__.py
RedisQuery._execute_query
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...
python
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", ")", ":", "pipe", "=", "self", ".", "pipe", "if", "not", "self", ".", "card", ":", "if", "self", ".", "meta", ".", "ordering", ":", "self", ".", "ismember", "=", "getattr", "(", "self", ".", "backend", ".", "cl...
Execute the query without fetching data. Returns the number of elements in the query.
[ "Execute", "the", "query", "without", "fetching", "data", ".", "Returns", "the", "number", "of", "elements", "in", "the", "query", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L222-L239
train
lsbardel/python-stdnet
stdnet/backends/redisb/__init__.py
RedisQuery.order
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...
python
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", ")", ":", "desc", "=", "last", ".", "desc", "field", "=", "last", ".", "name", "nested", "=", "last", ".", "nested", "nested_args", "=", "[", "]", "while", "nested", ":", "meta", "=", "nested", ".", "model"...
Perform ordering with respect model fields.
[ "Perform", "ordering", "with", "respect", "model", "fields", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L241-L258
train
lsbardel/python-stdnet
stdnet/backends/redisb/__init__.py
RedisQuery.related_lua_args
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 = ...
python
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", ")", ":", "related", "=", "self", ".", "queryelem", ".", "select_related", "if", "related", ":", "meta", "=", "self", ".", "meta", "for", "rel", "in", "related", ":", "field", "=", "meta", ".", "dfields", "[", "r...
Generator of load_related arguments
[ "Generator", "of", "load_related", "arguments" ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L346-L363
train
lsbardel/python-stdnet
stdnet/backends/redisb/__init__.py
Zset.ipop_range
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), ...
python
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", ")", ":", "return", "self", ".", "backend", ".", "execute", "(", "self", ".", "client", ".", "zpopbyrank", "(", "self"...
Remove and return a range from the ordered set by rank (index).
[ "Remove", "and", "return", "a", "range", "from", "the", "ordered", "set", "by", "rank", "(", "index", ")", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L482-L487
train
lsbardel/python-stdnet
stdnet/backends/redisb/__init__.py
Zset.pop_range
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), ...
python
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", ")", ":", "return", "self", ".", "backend", ".", "execute", "(", "self", ".", "client", ".", "zpopbyscore", "(", "self"...
Remove and return a range from the ordered set by score.
[ "Remove", "and", "return", "a", "range", "from", "the", "ordered", "set", "by", "score", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L489-L494
train
lsbardel/python-stdnet
stdnet/backends/redisb/__init__.py
BackendDataServer.meta
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
python
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", ")", ":", "data", "=", "meta", ".", "as_dict", "(", ")", "data", "[", "'namespace'", "]", "=", "self", ".", "basekey", "(", "meta", ")", "return", "data" ]
Extract model metadata for lua script stdnet/lib/lua/odm.lua
[ "Extract", "model", "metadata", "for", "lua", "script", "stdnet", "/", "lib", "/", "lua", "/", "odm", ".", "lua" ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L755-L759
train
lsbardel/python-stdnet
stdnet/backends/redisb/__init__.py
BackendDataServer.execute_session
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...
python
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", ")", ":", "pipe", "=", "self", ".", "client", ".", "pipeline", "(", ")", "for", "sm", "in", "session_data", ":", "# loop through model sessions\r", "meta", "=", "sm", ".", "meta", "if", "sm", ".",...
Execute a session in redis.
[ "Execute", "a", "session", "in", "redis", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L776-L814
train
lsbardel/python-stdnet
stdnet/backends/redisb/__init__.py
BackendDataServer.flush
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)
python
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", ")", ":", "pattern", "=", "self", ".", "basekey", "(", "meta", ")", "if", "meta", "else", "self", ".", "namespace", "return", "self", ".", "client", ".", "delpattern", "(", "'%s*'", "%", "pattern...
Flush all model keys from the database
[ "Flush", "all", "model", "keys", "from", "the", "database" ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L850-L853
train
rodluger/everest
everest/gp.py
GetCovariance
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 ...
python
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", ")", ":", "# NOTE: We purposefully compute the covariance matrix", "# *without* the GP white noise term", "K", "=", "np", ".", "diag", "(", "errors", "**", "2", ")", "K", "+=", ...
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*)...
[ "Returns", "the", "covariance", "matrix", "for", "a", "given", "light", "curve", "segment", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/gp.py#L71-L89
train
rodluger/everest
everest/gp.py
GetKernelParams
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...
python
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", ")", ":", "log", ".", "info", "(", "\"Optim...
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...
[ "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", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/gp.py#L92-L192
train
rodluger/everest
everest/gp.py
NegLnLike
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 ...
python
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", ")", ":", "gp", "=", "GP", "(", "kernel", ",", "x", ",", "white", "=", "True", ")", "gp", ".", "compute", "(", "time", ",", "errors", ")", "if", "OLDGEORGE", ...
Returns the negative log-likelihood function and its gradient.
[ "Returns", "the", "negative", "log", "-", "likelihood", "function", "and", "its", "gradient", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/gp.py#L195-L231
train
lsbardel/python-stdnet
stdnet/utils/dates.py
missing_intervals
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 ...
python
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", ")", ":", "parseinterval", "=", "parseinterval", "or", "default_parse_i...
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.
[ "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", ...
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/utils/dates.py#L120-L161
train
lsbardel/python-stdnet
stdnet/utils/dates.py
dategenerator
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...
python
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", ")", ":", "delta", "=", "timedelta", "(", "abs", "(", "step", ")", ")", "end", "=", "max", "(", "start", ",", "end", ")", "if", "desc", ":", "dt...
Generates dates between *atrt* and *end*.
[ "Generates", "dates", "between", "*", "atrt", "*", "and", "*", "end", "*", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/utils/dates.py#L164-L177
train
rodluger/everest
everest/utils.py
InitLog
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...
python
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", ")", ":", "# Initialize the logging", "root", "=", "logging", ".", "getLogger", ...
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...
[ "A", "little", "routine", "to", "initialize", "the", "logging", "functionality", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/utils.py#L66-L113
train
rodluger/everest
everest/utils.py
ExceptionHook
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...
python
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", ")", ":", "for", "line", "in", "traceback", ".", "format_exception_only", "(", "exctype", ",", "value", ")", ":", "log", ".", "error", "(", "line", ".", "replace", "(", "'\\n'", ",", "''"...
A custom exception handler that logs errors to file.
[ "A", "custom", "exception", "handler", "that", "logs", "errors", "to", "file", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/utils.py#L116-L126
train
rodluger/everest
everest/utils.py
ExceptionHookPDB
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...
python
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", ")", ":", "for", "line", "in", "traceback", ".", "format_exception_only", "(", "exctype", ",", "value", ")", ":", "log", ".", "error", "(", "line", ".", "replace", "(", "'\\n'", ",", "...
A custom exception handler, with :py:obj:`pdb` post-mortem for debugging.
[ "A", "custom", "exception", "handler", "with", ":", "py", ":", "obj", ":", "pdb", "post", "-", "mortem", "for", "debugging", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/utils.py#L129-L140
train
rodluger/everest
everest/utils.py
sort_like
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 ...
python
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", ")", ":", "s", "=", "np", ".", "zeros_like", "(", "col1", ")", "*", "np", ".", "nan", "for", "i", ",", "c", "in", "enumerate", "(", "col1", ")", ":", "j", "=", "np", ".", "argmax", "(", ...
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 ...
[ "Sorts", "the", "list", ":", "py", ":", "obj", ":", "l", "by", "comparing", ":", "py", ":", "obj", ":", "col2", "to", ":", "py", ":", "obj", ":", "col1", ".", "Specifically", "finds", "the", "indices", ":", "py", ":", "obj", ":", "i", "such", "...
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/utils.py#L159-L183
train
rodluger/everest
everest/utils.py
prange
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 ...
python
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", ")", ":", "try", ":", "root", "=", "logging", ".", "getLogger", "(", ")", "if", "len", "(", "root", ".", "handlers", ")", ":", "for", "h", "in", "root", ".", "handlers", ":", "if", "(", "type", "(", "h", ")", "...
Progress bar range with `tqdm`
[ "Progress", "bar", "range", "with", "tqdm" ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/utils.py#L237-L256
train
lsbardel/python-stdnet
stdnet/apps/columnts/npts.py
ColumnTS.front
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]
python
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", ")", ":", "ts", "=", "self", ".", "irange", "(", "0", ",", "0", ",", "fields", "=", "fields", ")", "if", "ts", ":", "return", "ts", ".", "start", "(", ")", ",", "ts", "[", "0", "]" ]
Return the front pair of the structure
[ "Return", "the", "front", "pair", "of", "the", "structure" ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/apps/columnts/npts.py#L19-L23
train
lsbardel/python-stdnet
stdnet/apps/columnts/npts.py
ColumnTS.back
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]
python
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", ")", ":", "ts", "=", "self", ".", "irange", "(", "-", "1", ",", "-", "1", ",", "fields", "=", "fields", ")", "if", "ts", ":", "return", "ts", ".", "end", "(", ")", ",", "ts", "[", "0", "]" ]
Return the back pair of the structure
[ "Return", "the", "back", "pair", "of", "the", "structure" ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/apps/columnts/npts.py#L25-L29
train
lsbardel/python-stdnet
stdnet/backends/__init__.py
parse_backend
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, '' ...
python
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", ")", ":", "r", "=", "urlparse", ".", "urlsplit", "(", "backend", ")", "scheme", ",", "host", "=", "r", ".", "scheme", ",", "r", ".", "netloc", "path", ",", "query", "=", "r", ".", "path", ",", "r", ".", "qu...
Converts the "backend" into the database connection parameters. It returns a (scheme, host, params) tuple.
[ "Converts", "the", "backend", "into", "the", "database", "connection", "parameters", ".", "It", "returns", "a", "(", "scheme", "host", "params", ")", "tuple", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/__init__.py#L470-L488
train
lsbardel/python-stdnet
stdnet/backends/__init__.py
getdb
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...
python
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", ")", ":", "if", "isinstance", "(", "backend", ",", "BackendDataServer", ")", ":", "return", "backend", "backend", "=", "backend", "or", "settings", ".", "DEFAULT_BACKEND", "if", "not", ...
get a :class:`BackendDataServer`.
[ "get", "a", ":", "class", ":", "BackendDataServer", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/__init__.py#L499-L510
train
lsbardel/python-stdnet
stdnet/backends/__init__.py
BackendDataServer.basekey
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...
python
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", ")", ":", "key", "=", "'%s%s'", "%", "(", "self", ".", "namespace", ",", "meta", ".", "modelkey", ")", "postfix", "=", "':'", ".", "join", "(", "(", "str", "(", "p", ")", "for", "p",...
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
[ "Calculate", "the", "key", "to", "access", "model", "data", ".", ":", "parameter", "meta", ":", "a", ":", "class", ":", "stdnet", ".", "odm", ".", "Metaclass", ".", ":", "parameter", "args", ":", "optional", "list", "of", "strings", "to", "prepend", "t...
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/__init__.py#L208-L217
train
lsbardel/python-stdnet
stdnet/backends/__init__.py
BackendDataServer.make_objects
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...
python
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", ")", ":", "make_object", "=", "meta", ".", "make_object", "related_data", "=", "[", "]", "if", "related_fields", ":", "for", "fname", ",", "fdata", "in", "i...
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.
[ "Generator", "of", ":", "class", ":", "stdnet", ".", "odm", ".", "StdModel", "instances", "with", "data", "from", "database", ".", ":", "parameter", "meta", ":", "instance", "of", "model", ":", "class", ":", "stdnet", ".", "odm", ".", "Metaclass", ".", ...
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/__init__.py#L227-L258
train
lsbardel/python-stdnet
stdnet/backends/__init__.py
BackendDataServer.structure
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:...
python
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", ")", ":", "struct", "=", "self", ".", "struct_map", ".", "get", "(", "instance", ".", "_meta", ".", "name", ")", "if", "struct", "is", "None", ":", "raise", "ModelNotAvailabl...
Create a backend :class:`stdnet.odm.Structure` handler. :param instance: a :class:`stdnet.odm.Structure` :param client: Optional client handler.
[ "Create", "a", "backend", ":", "class", ":", "stdnet", ".", "odm", ".", "Structure", "handler", ".", ":", "param", "instance", ":", "a", ":", "class", ":", "stdnet", ".", "odm", ".", "Structure", ":", "param", "client", ":", "Optional", "client", "hand...
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/__init__.py#L263-L274
train
rodluger/everest
everest/user.py
Search
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...
python
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'", ")", ":", "# 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...
Why is my target not in the EVEREST database?
[ "Why", "is", "my", "target", "not", "in", "the", "EVEREST", "database?" ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L61-L135
train
rodluger/everest
everest/user.py
DownloadFile
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 ...
python
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", ")", ":", "# Get season", "if", "season", "is", "None", ":", "season", ...
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...
[ "Download", "a", "given", ":", "py", ":", "mod", ":", "everest", "file", "from", "MAST", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L137-L228
train
rodluger/everest
everest/user.py
DVS
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...
python
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'", ")", ":", "# Get season", "if", "season", "is", "None", ":", "season", "=", "g...
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`
[ "Show", "the", "data", "validation", "summary", "(", "DVS", ")", "for", "a", "given", "target", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L231-L275
train
rodluger/everest
everest/user.py
Everest.compute
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 ...
python
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", ")", ":", "# If we're doing iterative PLD, get the normalization", "if", "self", ".", "model_name", "==", "'iPLD'", ":", "self", ".", "_get_norm", "(", ")", "# Compute as usual", "super", "(", "Everest", ",", "self", ")", ".", "com...
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...
[ "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...
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L368-L387
train
rodluger/everest
everest/user.py
Everest._get_norm
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...
python
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", ")", ":", "log", ".", "info", "(", "'Computing the PLD normalization...'", ")", "# Loop over all chunks", "mod", "=", "[", "None", "for", "b", "in", "self", ".", "breakpoints", "]", "for", "b", ",", "brkpt", "in", "enumerate"...
Computes the PLD flux normalization array. ..note :: `iPLD` model **only**.
[ "Computes", "the", "PLD", "flux", "normalization", "array", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L389-L467
train
rodluger/everest
everest/user.py
Everest.load_fits
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 ...
python
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", ")", ":", "log", ".", "info", "(", "\"Loading FITS file for %d.\"", "%", "(", "self", ".", "ID", ")", ")", "with", "pyfits", ".", "open", "(", "self", ".", "fitsfile", ")", "as", "f", ":", "# Params and long cadence data", ...
Load the FITS file from disk and populate the class instance with its data.
[ "Load", "the", "FITS", "file", "from", "disk", "and", "populate", "the", "class", "instance", "with", "its", "data", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L469-L621
train
rodluger/everest
everest/user.py
Everest.plot_aperture
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` '''...
python
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", ")", ":", "# Set up the axes", "fig", ",", "ax", "=", "pl", ".", "subplots", "(", "2", ",", "2", ",", "figsize", "=", "(", "6", ",", "8", ")", ")", "fig", ".", "subplots_adjust", "(", ...
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", ")", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L623-L646
train
rodluger/everest
everest/user.py
Everest.plot
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` ...
python
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", ")", ":", "log",...
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 ...
[ "Plots", "the", "final", "de", "-", "trended", "light", "curve", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L648-L839
train
rodluger/everest
everest/user.py
Everest.dvs
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)
python
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", ")", ":", "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.
[ "Shows", "the", "data", "validation", "summary", "(", "DVS", ")", "for", "the", "target", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L841-L848
train
rodluger/everest
everest/user.py
Everest.plot_pipeline
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...
python
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", ")", ":", "if", "pipeline", "!=", "'everest2'", ":", "return", "getattr", "(", "missions", ",", "self", ".", "mission", ")", ".", "pipelines", ".", "plot",...
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'...
[ "Plots", "the", "light", "curve", "for", "the", "target", "de", "-", "trended", "with", "a", "given", "pipeline", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L850-L925
train
rodluger/everest
everest/user.py
Everest.get_pipeline
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...
python
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", ")", ":", "return", "getattr", "(", "missions", ",", "self", ".", "mission", ")", ".", "pipelines", ".", "get", "(", "self", ".", "ID", ",", "*", "args", ",", "*", "*"...
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.
[ "Returns", "the", "time", "and", "flux", "arrays", "for", "the", "target", "obtained", "by", "a", "given", "pipeline", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L927-L938
train
rodluger/everest
everest/user.py
Everest.mask_planet
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...
python
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", "=", "[", "]", "t0", "+=", "np", ".", "ceil", "(", "(", "self", ".", "time", "[", "0", "]", "-", "dur", "-", "t0", ")", "/", "period", ")...
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 ...
[ "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", ...
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L940-L957
train
rodluger/everest
everest/user.py
Everest._plot_weights
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...
python
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", ")", ":", "# Set up the axes", "fig", "=", "pl", ".", "figure", "(", "figsize", "=", "(", "12", ",", "12", ")", ")", "fig", ".", "subplots_adjust", "(", "top", "=", "0.95", ",", "bottom",...
.. warning:: Untested!
[ "..", "warning", "::", "Untested!" ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L959-L1139
train
rodluger/everest
everest/user.py
Everest._save_npz
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) ...
python
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", ")", ":", "# Save the data", "d", "=", "dict", "(", "self", ".", "__dict__", ")", "d", ".", "pop", "(", "'_weights'", ",", "None", ")", "d", ".", "pop", "(", "'_A'", ",", "None", ")", "d", ".", "pop", "(", "'_B'",...
Saves all of the de-trending information to disk in an `npz` file
[ "Saves", "all", "of", "the", "de", "-", "trending", "information", "to", "disk", "in", "an", "npz", "file" ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L1298-L1317
train
rodluger/everest
everest/user.py
Everest.optimize
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, ...
python
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", ")", ":", "self", ".", "_save_npz", "(", ")", "optimized", "=", "pPLD", "(", "self", ".", "ID", ",", "piter", "=", "piter", ",", "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`.
[ "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", ...
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L1319-L1330
train
rodluger/everest
everest/user.py
Everest.plot_folded
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...
python
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", ")", ":", "# Mask the planet", "self", ".", "mask_planet", "(", "t0", ",", "period", ",", "dur", ")", "# Whiten", "gp", "=", "GP", "(", "self", ".", "kernel", ",", ...
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...
[ "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...
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L1332-L1383
train
rodluger/everest
everest/user.py
Everest.plot_transit_model
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...
python
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", ")", ":", "if", "self", ".", "transit_model", "is", "None", ":", "raise", "ValueError", "(", "\"No transit model provided!\"", ")", "if", ...
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`....
[ "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", ...
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L1385-L1549
train
rodluger/everest
everest/mathutils.py
Interpolate
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 ...
python
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", ")", ":", "# Ensure `y` doesn't get modified in place", "yy", "=", "np", ".", "array", "(", "y", ")", "t_", "=", "np", ".", "delete", "(", "time", ",", "mask", ")", "y_", "=", "np", ".", "dele...
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
[ "Masks", "certain", "elements", "in", "the", "array", "y", "and", "linearly", "interpolates", "over", "them", "returning", "an", "array", "y", "of", "the", "same", "length", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/mathutils.py#L21-L44
train
rodluger/everest
everest/mathutils.py
Chunks
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: ...
python
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", ")", ":", "if", "all", ":", "jarr", "=", "range", "(", "0", ",", "n", "-", "1", ")", "else", ":", "jarr", "=", "[", "0", "]", "for", "j", "in", "jarr", ":", "for", "i", "in", ...
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.
[ "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...
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/mathutils.py#L58-L78
train
rodluger/everest
everest/mathutils.py
Smooth
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: ...
python
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'", ")", ":", "if", "window_len", "==", "0", ":", "return", "np", ".", "zeros_like", "(", "x", ")", "s", "=", "np", ".", "r_", "[", "2", "*", "x", "[", "0", ...
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`
[ "Smooth", "data", "by", "convolving", "on", "a", "given", "timescale", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/mathutils.py#L81-L101
train
rodluger/everest
everest/mathutils.py
Scatter
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...
python
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", ")", ":", "if", "remove_outliers", ":", "# Remove 5-sigma outliers from data", "# smoothed on a 1 day timescale", "if", "len", "(", "y", ")", ">=", "50", ":", "ys", "=", ...
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...
[ "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",...
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/mathutils.py#L104-L136
train
rodluger/everest
everest/mathutils.py
SavGol
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
python
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", ")", ":", "if", "len", "(", "y", ")", ">=", "win", ":", "return", "y", "-", "savgol_filter", "(", "y", ",", "win", ",", "2", ")", "+", "np", ".", "nanmedian", "(", "y", ")", "else", ":", "re...
Subtracts a second order Savitsky-Golay filter with window size `win` and returns the result. This acts as a high pass filter.
[ "Subtracts", "a", "second", "order", "Savitsky", "-", "Golay", "filter", "with", "window", "size", "win", "and", "returns", "the", "result", ".", "This", "acts", "as", "a", "high", "pass", "filter", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/mathutils.py#L139-L149
train
rodluger/everest
everest/mathutils.py
NumRegressors
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: ...
python
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", ")", ":", "res", "=", "0", "for", "k", "in", "range", "(", "1", ",", "pld_order", "+", "1", ")", ":", "if", "cross_terms", ":", "res", "+=", "comb", "(", "npix"...
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`
[ "Return", "the", "number", "of", "regressors", "for", "npix", "pixels", "and", "PLD", "order", "pld_order", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/mathutils.py#L152-L167
train
rodluger/everest
everest/mathutils.py
Downbin
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...
python
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'", ")", ":", "assert", "newsize", "<", "x", ".", "shape", "[", "axis", "]", ",", "\"The new size of the array must be smaller than the current size.\"", "oldsize", ...
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`
[ "Downbins", "an", "array", "to", "a", "smaller", "size", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/mathutils.py#L170-L205
train
lsbardel/python-stdnet
stdnet/odm/fields.py
Field.register_with_model
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...
python
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", ")", ":", "if", "self", ".", "name", ":", "raise", "FieldError", "(", "'Field %s is already registered\\\n with a model'", "%", "self", ")", "self", ".", "name", "=", "name", "self", ".", ...
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.
[ "Called", "during", "the", "creation", "of", "a", "the", ":", "class", ":", "StdModel", "class", "when", ":", "class", ":", "Metaclass", "is", "initialised", ".", "It", "fills", ":", "attr", ":", "Field", ".", "name", "and", ":", "attr", ":", "Field", ...
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/fields.py#L192-L210
train
lsbardel/python-stdnet
stdnet/odm/fields.py
Field.add_to_fields
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)
python
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", ")", ":", "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`.
[ "Add", "this", ":", "class", ":", "Field", "to", "the", "fields", "of", ":", "attr", ":", "model", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/fields.py#L212-L217
train
lsbardel/python-stdnet
stdnet/odm/fields.py
Field.get_lookup
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...
python
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", ")", ":", "if", "remaining", ":", "raise", "errorClass", "(", "'Cannot use nested lookup on field %s'", "%", "self", ")", "return", "(", "self", ".", "attname", ",", "Non...
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* ...
[ "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", ":", ...
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/fields.py#L254-L264
train
lsbardel/python-stdnet
stdnet/odm/fields.py
Field.get_value
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...
python
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", ")", ":", "if", "bits", ":", "raise", "AttributeError", "else", ":", "return", "getattr", "(", "instance", ",", "self", ".", "attname", ")" ]
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...
[ "Retrieve", "the", "value", ":", "class", ":", "Field", "from", "a", ":", "class", ":", "StdModel", "instance", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/fields.py#L272-L288
train
lsbardel/python-stdnet
stdnet/odm/fields.py
Field.set_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))
python
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", ")", ":", "setattr", "(", "instance", ",", "self", ".", "attname", ",", "self", ".", "to_python", "(", "value", ")", ")" ]
Set the ``value`` for this :class:`Field` in a ``instance`` of a :class:`StdModel`.
[ "Set", "the", "value", "for", "this", ":", "class", ":", "Field", "in", "a", "instance", "of", "a", ":", "class", ":", "StdModel", "." ]
78db5320bdedc3f28c5e4f38cda13a4469e35db7
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/fields.py#L290-L293
train
lotabout/pymustache
pymustache/mustache.py
lookup
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_...
python
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", ")", ":", "start", "=", "len", "(", "contexts", ")", "if", "start", ">=", "0", "else", "start", "for", "context", "in", "reversed", "(", "contexts", "[", ":",...
lookup the value of the var_name on the stack of contexts :var_name: TODO :contexts: TODO :returns: None if not found
[ "lookup", "the", "value", "of", "the", "var_name", "on", "the", "stack", "of", "contexts" ]
d4089e49cda01fc11bab0c986d95e25150a60bac
https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L34-L50
train
lotabout/pymustache
pymustache/mustache.py
delimiters_to_re
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 = ''....
python
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", ")", ":", "# caching", "delimiters", "=", "tuple", "(", "delimiters", ")", "if", "delimiters", "in", "re_delimiters", ":", "re_tag", "=", "re_delimiters", "[", "delimiters", "]", "else", ":", "open_tag", ",", "clos...
convert delimiters to corresponding regular expressions
[ "convert", "delimiters", "to", "corresponding", "regular", "expressions" ]
d4089e49cda01fc11bab0c986d95e25150a60bac
https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L69-L86
train
lotabout/pymustache
pymustache/mustache.py
is_standalone
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[...
python
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", ")", ":", "left", "=", "False", "start", "-=", "1", "while", "start", ">=", "0", "and", "text", "[", "start", "]", "in", "spaces_not_newline", ":", "start", "-=", "1", "if", "start", "<",...
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]
[ "check", "if", "the", "string", "text", "[", "start", ":", "end", "]", "is", "standalone", "by", "checking", "forwards", "and", "backwards", "for", "blankspaces", ":", "text", ":", "TODO", ":", "(", "start", "end", ")", ":", "TODO", ":", "returns", ":"...
d4089e49cda01fc11bab0c986d95e25150a60bac
https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L91-L108
train
lotabout/pymustache
pymustache/mustache.py
compiled
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 = []...
python
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", ")", ":", "re_tag", "=", "delimiters_to_re", "(", "delimiters", ")", "# variable to save states", "tokens", "=", "[", "]", "index", "=", "0", "sections", "=", "[", "]", "tokens_s...
Compile a template into token tree :template: TODO :delimiters: TODO :returns: the root token
[ "Compile", "a", "template", "into", "token", "tree" ]
d4089e49cda01fc11bab0c986d95e25150a60bac
https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L110-L229
train
lotabout/pymustache
pymustache/mustache.py
Token._escape
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
python
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", ")", ":", "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
[ "Escape", "text", "according", "to", "self", ".", "escape" ]
d4089e49cda01fc11bab0c986d95e25150a60bac
https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L263-L269
train
lotabout/pymustache
pymustache/mustache.py
Token._lookup
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 '.....
python
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", ")", ":", "# process filters", "filters", "=", "[", "x", "for", "x", "in", "map", "(", "lambda", "x", ":", "x", ".", "strip", "(", ")", ",", "dot_name", ".", "split", "(", "'|'", ")",...
lookup value for names like 'a.b.c' and handle filters as well
[ "lookup", "value", "for", "names", "like", "a", ".", "b", ".", "c", "and", "handle", "filters", "as", "well" ]
d4089e49cda01fc11bab0c986d95e25150a60bac
https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L271-L332
train
lotabout/pymustache
pymustache/mustache.py
Token._render_children
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)
python
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", ")", ":", "ret", "=", "[", "]", "for", "child", "in", "self", ".", "children", ":", "ret", ".", "append", "(", "child", ".", "_render", "(", "contexts", ",", "partials", ")", "...
Render the children tokens
[ "Render", "the", "children", "tokens" ]
d4089e49cda01fc11bab0c986d95e25150a60bac
https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L334-L339
train
lotabout/pymustache
pymustache/mustache.py
Variable._render
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)
python
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", ")", ":", "value", "=", "self", ".", "_lookup", "(", "self", ".", "value", ",", "contexts", ")", "# lambda", "if", "callable", "(", "value", ")", ":", "value", "=", "inner_render", "(", ...
render variable
[ "render", "variable" ]
d4089e49cda01fc11bab0c986d95e25150a60bac
https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L385-L393
train
lotabout/pymustache
pymustache/mustache.py
Section._render
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...
python
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", ")", ":", "val", "=", "self", ".", "_lookup", "(", "self", ".", "value", ",", "contexts", ")", "if", "not", "val", ":", "# false value", "return", "EMPTYSTRING", "# normally json has types: num...
render section
[ "render", "section" ]
d4089e49cda01fc11bab0c986d95e25150a60bac
https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L400-L434
train
lotabout/pymustache
pymustache/mustache.py
Inverted._render
def _render(self, contexts, partials): """render inverted section""" val = self._lookup(self.value, contexts) if val: return EMPTYSTRING return self._render_children(contexts, partials)
python
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", ")", ":", "val", "=", "self", ".", "_lookup", "(", "self", ".", "value", ",", "contexts", ")", "if", "val", ":", "return", "EMPTYSTRING", "return", "self", ".", "_render_children", "(", "...
render inverted section
[ "render", "inverted", "section" ]
d4089e49cda01fc11bab0c986d95e25150a60bac
https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L442-L447
train
lotabout/pymustache
pymustache/mustache.py
Partial._render
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...
python
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", ")", ":", "try", ":", "partial", "=", "partials", "[", "self", ".", "value", "]", "except", "KeyError", "as", "e", ":", "return", "self", ".", "_escape", "(", "EMPTYSTRING", ")", "partial...
render partials
[ "render", "partials" ]
d4089e49cda01fc11bab0c986d95e25150a60bac
https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L465-L474
train
rodluger/everest
everest/missions/k2/k2.py
Setup
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)
python
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", "(", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "EVEREST_DAT", ",", "'k2'", ",", "'cbv'", ")", ")", ":", "os", ".", "makedirs", "(", "os", ".", "path", ".", "join", "(", ...
Called when the code is installed. Sets up directories and downloads the K2 catalog.
[ "Called", "when", "the", "code", "is", "installed", ".", "Sets", "up", "directories", "and", "downloads", "the", "K2", "catalog", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L50-L59
train
rodluger/everest
everest/missions/k2/k2.py
CDPP
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...
python
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'", ")", ":", "# 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", ...
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`
[ "Compute", "the", "proxy", "6", "-", "hr", "CDPP", "metric", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L169-L194
train
rodluger/everest
everest/missions/k2/k2.py
GetData
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...
python
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_pixel...
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...
[ "Returns", "a", ":", "py", ":", "obj", ":", "DataContainer", "instance", "with", "the", "raw", "data", "for", "the", "target", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L197-L712
train
rodluger/everest
everest/missions/k2/k2.py
GetNeighbors
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...
python
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'", ",", ...
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...
[ "Return", "neighbors", "random", "bright", "stars", "on", "the", "same", "module", "as", "EPIC", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L715-L881
train
rodluger/everest
everest/missions/k2/k2.py
PlanetStatistics
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 \ ...
python
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", ")", ":", "# Load all planet hosts", "f", "=", "os", ".", "path", ".", "join", "(", "EVEREST_SRC", ",", "'missions'", ",", "'k2'", ",", "'...
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
[ "Computes", "and", "plots", "the", "CDPP", "statistics", "comparison", "between", "model", "and", "compare_to", "for", "all", "known", "K2", "planets", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L884-L961
train
rodluger/everest
everest/missions/k2/k2.py
ShortCadenceStatistics
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. ...
python
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", ")", ":", "# Check campaign", "if", "campaign", "is", "None", ":", "campaign", "=...
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 ...
[ "Computes", "and", "plots", "the", "CDPP", "statistics", "comparison", "between", "short", "cadence", "and", "long", "cadence", "de", "-", "trended", "light", "curves" ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L964-L1119
train
rodluger/everest
everest/missions/k2/k2.py
Statistics
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 ...
python
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", "=", ...
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...
[ "Computes", "and", "plots", "the", "CDPP", "statistics", "comparison", "between", "model", "and", "compare_to", "for", "all", "long", "cadence", "light", "curves", "in", "a", "given", "campaign" ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L1122-L1446
train
rodluger/everest
everest/missions/k2/k2.py
HasShortCadence
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: ...
python
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", ")", ":", "if", "season", "is", "None", ":", "season", "=", "Campaign", "(", "EPIC", ")", "if", "season", "is", "None", ":", "return", "None", "stars", "=", "GetK2Campaign", "(", "seaso...
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`
[ "Returns", "True", "if", "short", "cadence", "data", "is", "available", "for", "this", "target", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L1449-L1467
train
rodluger/everest
everest/missions/k2/k2.py
InjectionStatistics
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...
python
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", ")", ":", "# Compute the statistics", "stars", "=", "GetK2Cam...
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...
[ "Computes", "and", "plots", "the", "statistics", "for", "injection", "/", "recovery", "tests", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L1470-L1656
train
rodluger/everest
everest/missions/k2/k2.py
HDUCards
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'...
python
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", ")", ":", "if", "headers", "is", "None", ":", "return", "[", "]", "if", "hdu", "==", "0", ":", "# Get info from the TPF Primary HDU Header", "tpf_header", "=", "headers", "[", "0", "]", "entries", ...
Generates HDU cards for inclusion in the de-trended light curve FITS file. Used internally.
[ "Generates", "HDU", "cards", "for", "inclusion", "in", "the", "de", "-", "trended", "light", "curve", "FITS", "file", ".", "Used", "internally", "." ]
6779591f9f8b3556847e2fbf761bdfac7520eaea
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L1659-L1763
train