repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
openxc/openxc-python
openxc/controllers/base.py
ResponseReceiver.handle_responses
def handle_responses(self): """Block and wait for responses to this object's original request, or until a timeout (self.COMMAND_RESPONSE_TIMEOUT_S). This function is handy to use as the target function for a thread. The responses received (or None if none was received before the timeou...
python
def handle_responses(self): """Block and wait for responses to this object's original request, or until a timeout (self.COMMAND_RESPONSE_TIMEOUT_S). This function is handy to use as the target function for a thread. The responses received (or None if none was received before the timeou...
[ "def", "handle_responses", "(", "self", ")", ":", "while", "self", ".", "running", ":", "try", ":", "response", "=", "self", ".", "queue", ".", "get", "(", "timeout", "=", "self", ".", "COMMAND_RESPONSE_TIMEOUT_S", ")", "if", "self", ".", "_response_matche...
Block and wait for responses to this object's original request, or until a timeout (self.COMMAND_RESPONSE_TIMEOUT_S). This function is handy to use as the target function for a thread. The responses received (or None if none was received before the timeout) is stored in a list at self....
[ "Block", "and", "wait", "for", "responses", "to", "this", "object", "s", "original", "request", "or", "until", "a", "timeout", "(", "self", ".", "COMMAND_RESPONSE_TIMEOUT_S", ")", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/controllers/base.py#L71-L90
openxc/openxc-python
openxc/controllers/base.py
DiagnosticResponseReceiver._response_matches_request
def _response_matches_request(self, response): """Return true if the response is to a diagnostic request, and the bus, id, mode match. If the request was successful, the PID echo is also checked. """ # Accept success/failure command responses if super(DiagnosticResponseRe...
python
def _response_matches_request(self, response): """Return true if the response is to a diagnostic request, and the bus, id, mode match. If the request was successful, the PID echo is also checked. """ # Accept success/failure command responses if super(DiagnosticResponseRe...
[ "def", "_response_matches_request", "(", "self", ",", "response", ")", ":", "# Accept success/failure command responses", "if", "super", "(", "DiagnosticResponseReceiver", ",", "self", ")", ".", "_response_matches_request", "(", "response", ")", ":", "return", "True", ...
Return true if the response is to a diagnostic request, and the bus, id, mode match. If the request was successful, the PID echo is also checked.
[ "Return", "true", "if", "the", "response", "is", "to", "a", "diagnostic", "request", "and", "the", "bus", "id", "mode", "match", ".", "If", "the", "request", "was", "successful", "the", "PID", "echo", "is", "also", "checked", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/controllers/base.py#L115-L137
openxc/openxc-python
openxc/controllers/base.py
Controller.complex_request
def complex_request(self, request, wait_for_first_response=True): """Send a compound command request to the interface over the normal data channel. request - A dict storing the request to send to the VI. It will be serialized to the currently selected output format. wait_for...
python
def complex_request(self, request, wait_for_first_response=True): """Send a compound command request to the interface over the normal data channel. request - A dict storing the request to send to the VI. It will be serialized to the currently selected output format. wait_for...
[ "def", "complex_request", "(", "self", ",", "request", ",", "wait_for_first_response", "=", "True", ")", ":", "receiver", "=", "self", ".", "_prepare_response_receiver", "(", "request", ",", "receiver_class", "=", "CommandResponseReceiver", ")", "self", ".", "_sen...
Send a compound command request to the interface over the normal data channel. request - A dict storing the request to send to the VI. It will be serialized to the currently selected output format. wait_for_first_response - If true, this function will block waiting for a...
[ "Send", "a", "compound", "command", "request", "to", "the", "interface", "over", "the", "normal", "data", "channel", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/controllers/base.py#L159-L177
openxc/openxc-python
openxc/controllers/base.py
Controller.create_diagnostic_request
def create_diagnostic_request(self, message_id, mode, bus=None, pid=None, frequency=None, payload=None, wait_for_ack=True, wait_for_first_response=False, decoded_type=None): """Send a new diagnostic message request to the VI Required: message_id - The message ID (arbitr...
python
def create_diagnostic_request(self, message_id, mode, bus=None, pid=None, frequency=None, payload=None, wait_for_ack=True, wait_for_first_response=False, decoded_type=None): """Send a new diagnostic message request to the VI Required: message_id - The message ID (arbitr...
[ "def", "create_diagnostic_request", "(", "self", ",", "message_id", ",", "mode", ",", "bus", "=", "None", ",", "pid", "=", "None", ",", "frequency", "=", "None", ",", "payload", "=", "None", ",", "wait_for_ack", "=", "True", ",", "wait_for_first_response", ...
Send a new diagnostic message request to the VI Required: message_id - The message ID (arbitration ID) for the request. mode - the diagnostic mode (or service). Optional: bus - The address of the CAN bus controller to send the request, either 1 or 2 for current VI...
[ "Send", "a", "new", "diagnostic", "message", "request", "to", "the", "VI" ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/controllers/base.py#L213-L263
openxc/openxc-python
openxc/controllers/base.py
Controller.set_passthrough
def set_passthrough(self, bus, enabled): """Control the status of CAN message passthrough for a bus. Returns True if the command was successful. """ request = { "command": "passthrough", "bus": bus, "enabled": enabled } return self._ch...
python
def set_passthrough(self, bus, enabled): """Control the status of CAN message passthrough for a bus. Returns True if the command was successful. """ request = { "command": "passthrough", "bus": bus, "enabled": enabled } return self._ch...
[ "def", "set_passthrough", "(", "self", ",", "bus", ",", "enabled", ")", ":", "request", "=", "{", "\"command\"", ":", "\"passthrough\"", ",", "\"bus\"", ":", "bus", ",", "\"enabled\"", ":", "enabled", "}", "return", "self", ".", "_check_command_response_status...
Control the status of CAN message passthrough for a bus. Returns True if the command was successful.
[ "Control", "the", "status", "of", "CAN", "message", "passthrough", "for", "a", "bus", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/controllers/base.py#L269-L279
openxc/openxc-python
openxc/controllers/base.py
Controller.set_payload_format
def set_payload_format(self, payload_format): """Set the payload format for messages sent to and from the VI. Returns True if the command was successful. """ request = { "command": "payload_format", "format": payload_format } status = self._check_...
python
def set_payload_format(self, payload_format): """Set the payload format for messages sent to and from the VI. Returns True if the command was successful. """ request = { "command": "payload_format", "format": payload_format } status = self._check_...
[ "def", "set_payload_format", "(", "self", ",", "payload_format", ")", ":", "request", "=", "{", "\"command\"", ":", "\"payload_format\"", ",", "\"format\"", ":", "payload_format", "}", "status", "=", "self", ".", "_check_command_response_status", "(", "request", "...
Set the payload format for messages sent to and from the VI. Returns True if the command was successful.
[ "Set", "the", "payload", "format", "for", "messages", "sent", "to", "and", "from", "the", "VI", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/controllers/base.py#L281-L294
openxc/openxc-python
openxc/controllers/base.py
Controller.rtc_configuration
def rtc_configuration(self, unix_time): """Set the Unix time if RTC is supported on the device. Returns True if the command was successful. """ request = { "command": "rtc_configuration", "unix_time": unix_time } status = self._check_command_respo...
python
def rtc_configuration(self, unix_time): """Set the Unix time if RTC is supported on the device. Returns True if the command was successful. """ request = { "command": "rtc_configuration", "unix_time": unix_time } status = self._check_command_respo...
[ "def", "rtc_configuration", "(", "self", ",", "unix_time", ")", ":", "request", "=", "{", "\"command\"", ":", "\"rtc_configuration\"", ",", "\"unix_time\"", ":", "unix_time", "}", "status", "=", "self", ".", "_check_command_response_status", "(", "request", ")", ...
Set the Unix time if RTC is supported on the device. Returns True if the command was successful.
[ "Set", "the", "Unix", "time", "if", "RTC", "is", "supported", "on", "the", "device", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/controllers/base.py#L297-L307
openxc/openxc-python
openxc/controllers/base.py
Controller.modem_configuration
def modem_configuration(self, host, port): """Set the host:port for the Cellular device to send data to. Returns True if the command was successful. """ request = { "command": "modem_configuration", "host": host, "port": port } status ...
python
def modem_configuration(self, host, port): """Set the host:port for the Cellular device to send data to. Returns True if the command was successful. """ request = { "command": "modem_configuration", "host": host, "port": port } status ...
[ "def", "modem_configuration", "(", "self", ",", "host", ",", "port", ")", ":", "request", "=", "{", "\"command\"", ":", "\"modem_configuration\"", ",", "\"host\"", ":", "host", ",", "\"port\"", ":", "port", "}", "status", "=", "self", ".", "_check_command_re...
Set the host:port for the Cellular device to send data to. Returns True if the command was successful.
[ "Set", "the", "host", ":", "port", "for", "the", "Cellular", "device", "to", "send", "data", "to", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/controllers/base.py#L309-L320
openxc/openxc-python
openxc/controllers/base.py
Controller.set_acceptance_filter_bypass
def set_acceptance_filter_bypass(self, bus, bypass): """Control the status of CAN acceptance filter for a bus. Returns True if the command was successful. """ request = { "command": "af_bypass", "bus": bus, "bypass": bypass } return se...
python
def set_acceptance_filter_bypass(self, bus, bypass): """Control the status of CAN acceptance filter for a bus. Returns True if the command was successful. """ request = { "command": "af_bypass", "bus": bus, "bypass": bypass } return se...
[ "def", "set_acceptance_filter_bypass", "(", "self", ",", "bus", ",", "bypass", ")", ":", "request", "=", "{", "\"command\"", ":", "\"af_bypass\"", ",", "\"bus\"", ":", "bus", ",", "\"bypass\"", ":", "bypass", "}", "return", "self", ".", "_check_command_respons...
Control the status of CAN acceptance filter for a bus. Returns True if the command was successful.
[ "Control", "the", "status", "of", "CAN", "acceptance", "filter", "for", "a", "bus", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/controllers/base.py#L322-L332
openxc/openxc-python
openxc/controllers/base.py
Controller.sd_mount_status
def sd_mount_status(self): """Request for SD Mount status if available. """ request = { "command": "sd_mount_status" } responses = self.complex_request(request) result = None if len(responses) > 0: result = responses[0].get('status') ...
python
def sd_mount_status(self): """Request for SD Mount status if available. """ request = { "command": "sd_mount_status" } responses = self.complex_request(request) result = None if len(responses) > 0: result = responses[0].get('status') ...
[ "def", "sd_mount_status", "(", "self", ")", ":", "request", "=", "{", "\"command\"", ":", "\"sd_mount_status\"", "}", "responses", "=", "self", ".", "complex_request", "(", "request", ")", "result", "=", "None", "if", "len", "(", "responses", ")", ">", "0"...
Request for SD Mount status if available.
[ "Request", "for", "SD", "Mount", "status", "if", "available", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/controllers/base.py#L368-L378
openxc/openxc-python
openxc/controllers/base.py
Controller.write
def write(self, **kwargs): """Serialize a raw or translated write request and send it to the VI, following the OpenXC message format. """ if 'id' in kwargs and 'data' in kwargs: result = self.write_raw(kwargs['id'], kwargs['data'], bus=kwargs.get('bus', No...
python
def write(self, **kwargs): """Serialize a raw or translated write request and send it to the VI, following the OpenXC message format. """ if 'id' in kwargs and 'data' in kwargs: result = self.write_raw(kwargs['id'], kwargs['data'], bus=kwargs.get('bus', No...
[ "def", "write", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "'id'", "in", "kwargs", "and", "'data'", "in", "kwargs", ":", "result", "=", "self", ".", "write_raw", "(", "kwargs", "[", "'id'", "]", ",", "kwargs", "[", "'data'", "]", ",", ...
Serialize a raw or translated write request and send it to the VI, following the OpenXC message format.
[ "Serialize", "a", "raw", "or", "translated", "write", "request", "and", "send", "it", "to", "the", "VI", "following", "the", "OpenXC", "message", "format", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/controllers/base.py#L388-L399
openxc/openxc-python
openxc/controllers/base.py
Controller.write_translated
def write_translated(self, name, value, event=None): """Send a translated write request to the VI. """ data = {'name': name} if value is not None: data['value'] = self._massage_write_value(value) if event is not None: data['event'] = self._massage_write_va...
python
def write_translated(self, name, value, event=None): """Send a translated write request to the VI. """ data = {'name': name} if value is not None: data['value'] = self._massage_write_value(value) if event is not None: data['event'] = self._massage_write_va...
[ "def", "write_translated", "(", "self", ",", "name", ",", "value", ",", "event", "=", "None", ")", ":", "data", "=", "{", "'name'", ":", "name", "}", "if", "value", "is", "not", "None", ":", "data", "[", "'value'", "]", "=", "self", ".", "_massage_...
Send a translated write request to the VI.
[ "Send", "a", "translated", "write", "request", "to", "the", "VI", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/controllers/base.py#L401-L412
openxc/openxc-python
openxc/controllers/base.py
Controller.write_raw
def write_raw(self, message_id, data, bus=None, frame_format=None): """Send a raw write request to the VI. """ if not isinstance(message_id, numbers.Number): try: message_id = int(message_id, 0) except ValueError: raise ValueError("ID must ...
python
def write_raw(self, message_id, data, bus=None, frame_format=None): """Send a raw write request to the VI. """ if not isinstance(message_id, numbers.Number): try: message_id = int(message_id, 0) except ValueError: raise ValueError("ID must ...
[ "def", "write_raw", "(", "self", ",", "message_id", ",", "data", ",", "bus", "=", "None", ",", "frame_format", "=", "None", ")", ":", "if", "not", "isinstance", "(", "message_id", ",", "numbers", ".", "Number", ")", ":", "try", ":", "message_id", "=", ...
Send a raw write request to the VI.
[ "Send", "a", "raw", "write", "request", "to", "the", "VI", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/controllers/base.py#L414-L430
openxc/openxc-python
openxc/controllers/base.py
Controller._massage_write_value
def _massage_write_value(cls, value): """Convert string values from command-line arguments into first-order Python boolean and float objects, if applicable. """ if not isinstance(value, numbers.Number): if value == "true": value = True elif value =...
python
def _massage_write_value(cls, value): """Convert string values from command-line arguments into first-order Python boolean and float objects, if applicable. """ if not isinstance(value, numbers.Number): if value == "true": value = True elif value =...
[ "def", "_massage_write_value", "(", "cls", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "numbers", ".", "Number", ")", ":", "if", "value", "==", "\"true\"", ":", "value", "=", "True", "elif", "value", "==", "\"false\"", ":", "v...
Convert string values from command-line arguments into first-order Python boolean and float objects, if applicable.
[ "Convert", "string", "values", "from", "command", "-", "line", "arguments", "into", "first", "-", "order", "Python", "boolean", "and", "float", "objects", "if", "applicable", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/controllers/base.py#L440-L456
openxc/openxc-python
openxc/formats/json.py
JsonFormatter._validate
def _validate(cls, message): """Confirm the validitiy of a given dict as an OpenXC message. Returns: ``True`` if the message contains at least a ``name`` and ``value``. """ valid = False if(('name' in message and 'value' in message) or ('id' in messag...
python
def _validate(cls, message): """Confirm the validitiy of a given dict as an OpenXC message. Returns: ``True`` if the message contains at least a ``name`` and ``value``. """ valid = False if(('name' in message and 'value' in message) or ('id' in messag...
[ "def", "_validate", "(", "cls", ",", "message", ")", ":", "valid", "=", "False", "if", "(", "(", "'name'", "in", "message", "and", "'value'", "in", "message", ")", "or", "(", "'id'", "in", "message", "and", "'data'", "in", "message", ")", ")", ":", ...
Confirm the validitiy of a given dict as an OpenXC message. Returns: ``True`` if the message contains at least a ``name`` and ``value``.
[ "Confirm", "the", "validitiy", "of", "a", "given", "dict", "as", "an", "OpenXC", "message", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/formats/json.py#L42-L52
openxc/openxc-python
openxc/measurements.py
Measurement.value
def value(self, new_value): """Set the value of this measurement. Raises: AttributeError: if the new value isn't of the correct units. """ if self.unit != units.Undefined and new_value.unit != self.unit: raise AttributeError("%s must be in %s" % ( ...
python
def value(self, new_value): """Set the value of this measurement. Raises: AttributeError: if the new value isn't of the correct units. """ if self.unit != units.Undefined and new_value.unit != self.unit: raise AttributeError("%s must be in %s" % ( ...
[ "def", "value", "(", "self", ",", "new_value", ")", ":", "if", "self", ".", "unit", "!=", "units", ".", "Undefined", "and", "new_value", ".", "unit", "!=", "self", ".", "unit", ":", "raise", "AttributeError", "(", "\"%s must be in %s\"", "%", "(", "self"...
Set the value of this measurement. Raises: AttributeError: if the new value isn't of the correct units.
[ "Set", "the", "value", "of", "this", "measurement", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/measurements.py#L66-L75
openxc/openxc-python
openxc/measurements.py
Measurement.from_dict
def from_dict(cls, data): """Create a new Measurement subclass instance using the given dict. If Measurement.name_from_class was previously called with this data's associated Measurement sub-class in Python, the returned object will be an instance of that sub-class. If the measurement n...
python
def from_dict(cls, data): """Create a new Measurement subclass instance using the given dict. If Measurement.name_from_class was previously called with this data's associated Measurement sub-class in Python, the returned object will be an instance of that sub-class. If the measurement n...
[ "def", "from_dict", "(", "cls", ",", "data", ")", ":", "args", "=", "[", "]", "if", "'id'", "in", "data", "and", "'data'", "in", "data", ":", "measurement_class", "=", "CanMessage", "args", ".", "append", "(", "\"Bus %s: 0x%x\"", "%", "(", "data", ".",...
Create a new Measurement subclass instance using the given dict. If Measurement.name_from_class was previously called with this data's associated Measurement sub-class in Python, the returned object will be an instance of that sub-class. If the measurement name in ``data`` is unrecogniz...
[ "Create", "a", "new", "Measurement", "subclass", "instance", "using", "the", "given", "dict", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/measurements.py#L78-L106
openxc/openxc-python
openxc/measurements.py
Measurement.name_from_class
def name_from_class(cls, measurement_class): """For a given measurement class, return its generic name. The given class is expected to have a ``name`` attribute, otherwise this function will raise an execption. The point of using this method instead of just trying to grab that attribute...
python
def name_from_class(cls, measurement_class): """For a given measurement class, return its generic name. The given class is expected to have a ``name`` attribute, otherwise this function will raise an execption. The point of using this method instead of just trying to grab that attribute...
[ "def", "name_from_class", "(", "cls", ",", "measurement_class", ")", ":", "if", "not", "getattr", "(", "cls", ",", "'_measurements_initialized'", ",", "False", ")", ":", "cls", ".", "_measurement_map", "=", "dict", "(", "(", "m", ".", "name", ",", "m", "...
For a given measurement class, return its generic name. The given class is expected to have a ``name`` attribute, otherwise this function will raise an execption. The point of using this method instead of just trying to grab that attribute in the application is to cache measurement name...
[ "For", "a", "given", "measurement", "class", "return", "its", "generic", "name", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/measurements.py#L109-L135
openxc/openxc-python
openxc/sources/trace.py
TraceDataSource._store_timestamp
def _store_timestamp(self, timestamp): """If not already saved, cache the first timestamp in the active trace file on the instance. """ if getattr(self, 'first_timestamp', None) is None: self.first_timestamp = timestamp LOG.debug("Storing %d as the first timestamp...
python
def _store_timestamp(self, timestamp): """If not already saved, cache the first timestamp in the active trace file on the instance. """ if getattr(self, 'first_timestamp', None) is None: self.first_timestamp = timestamp LOG.debug("Storing %d as the first timestamp...
[ "def", "_store_timestamp", "(", "self", ",", "timestamp", ")", ":", "if", "getattr", "(", "self", ",", "'first_timestamp'", ",", "None", ")", "is", "None", ":", "self", ".", "first_timestamp", "=", "timestamp", "LOG", ".", "debug", "(", "\"Storing %d as the ...
If not already saved, cache the first timestamp in the active trace file on the instance.
[ "If", "not", "already", "saved", "cache", "the", "first", "timestamp", "in", "the", "active", "trace", "file", "on", "the", "instance", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/sources/trace.py#L45-L52
openxc/openxc-python
openxc/sources/trace.py
TraceDataSource.read
def read(self): """Read a line of data from the input source at a time.""" line = self.trace_file.readline() if line == '': if self.loop: self._reopen_file() else: self.trace_file.close() self.trace_file = None ...
python
def read(self): """Read a line of data from the input source at a time.""" line = self.trace_file.readline() if line == '': if self.loop: self._reopen_file() else: self.trace_file.close() self.trace_file = None ...
[ "def", "read", "(", "self", ")", ":", "line", "=", "self", ".", "trace_file", ".", "readline", "(", ")", "if", "line", "==", "''", ":", "if", "self", ".", "loop", ":", "self", ".", "_reopen_file", "(", ")", "else", ":", "self", ".", "trace_file", ...
Read a line of data from the input source at a time.
[ "Read", "a", "line", "of", "data", "from", "the", "input", "source", "at", "a", "time", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/sources/trace.py#L54-L70
openxc/openxc-python
openxc/sources/trace.py
TraceDataSource._open_file
def _open_file(filename): """Attempt to open the the file at ``filename`` for reading. Raises: DataSourceError, if the file cannot be opened. """ if filename is None: raise DataSourceError("Trace filename is not defined") try: trace_file = op...
python
def _open_file(filename): """Attempt to open the the file at ``filename`` for reading. Raises: DataSourceError, if the file cannot be opened. """ if filename is None: raise DataSourceError("Trace filename is not defined") try: trace_file = op...
[ "def", "_open_file", "(", "filename", ")", ":", "if", "filename", "is", "None", ":", "raise", "DataSourceError", "(", "\"Trace filename is not defined\"", ")", "try", ":", "trace_file", "=", "open", "(", "filename", ",", "\"r\"", ")", "except", "IOError", "as"...
Attempt to open the the file at ``filename`` for reading. Raises: DataSourceError, if the file cannot be opened.
[ "Attempt", "to", "open", "the", "the", "file", "at", "filename", "for", "reading", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/sources/trace.py#L73-L88
openxc/openxc-python
openxc/sources/trace.py
TraceDataSource._wait
def _wait(starting_time, first_timestamp, timestamp): """Given that the first timestamp in the trace file is ``first_timestamp`` and we started playing back the file at ``starting_time``, block until the current ``timestamp`` should occur. """ target_time = starting_time + (times...
python
def _wait(starting_time, first_timestamp, timestamp): """Given that the first timestamp in the trace file is ``first_timestamp`` and we started playing back the file at ``starting_time``, block until the current ``timestamp`` should occur. """ target_time = starting_time + (times...
[ "def", "_wait", "(", "starting_time", ",", "first_timestamp", ",", "timestamp", ")", ":", "target_time", "=", "starting_time", "+", "(", "timestamp", "-", "first_timestamp", ")", "time", ".", "sleep", "(", "max", "(", "target_time", "-", "time", ".", "time",...
Given that the first timestamp in the trace file is ``first_timestamp`` and we started playing back the file at ``starting_time``, block until the current ``timestamp`` should occur.
[ "Given", "that", "the", "first", "timestamp", "in", "the", "trace", "file", "is", "first_timestamp", "and", "we", "started", "playing", "back", "the", "file", "at", "starting_time", "block", "until", "the", "current", "timestamp", "should", "occur", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/sources/trace.py#L91-L97
openxc/openxc-python
openxc/utils.py
merge
def merge(a, b): """Merge two deep dicts non-destructively Uses a stack to avoid maximum recursion depth exceptions >>> a = {'a': 1, 'b': {1: 1, 2: 2}, 'd': 6} >>> b = {'c': 3, 'b': {2: 7}, 'd': {'z': [1, 2, 3]}} >>> c = merge(a, b) >>> from pprint import pprint; pprint(c) {'a': 1, 'b': {1...
python
def merge(a, b): """Merge two deep dicts non-destructively Uses a stack to avoid maximum recursion depth exceptions >>> a = {'a': 1, 'b': {1: 1, 2: 2}, 'd': 6} >>> b = {'c': 3, 'b': {2: 7}, 'd': {'z': [1, 2, 3]}} >>> c = merge(a, b) >>> from pprint import pprint; pprint(c) {'a': 1, 'b': {1...
[ "def", "merge", "(", "a", ",", "b", ")", ":", "assert", "quacks_like_dict", "(", "a", ")", ",", "quacks_like_dict", "(", "b", ")", "dst", "=", "a", ".", "copy", "(", ")", "stack", "=", "[", "(", "dst", ",", "b", ")", "]", "while", "stack", ":",...
Merge two deep dicts non-destructively Uses a stack to avoid maximum recursion depth exceptions >>> a = {'a': 1, 'b': {1: 1, 2: 2}, 'd': 6} >>> b = {'c': 3, 'b': {2: 7}, 'd': {'z': [1, 2, 3]}} >>> c = merge(a, b) >>> from pprint import pprint; pprint(c) {'a': 1, 'b': {1: 1, 2: 7}, 'c': 3, 'd':...
[ "Merge", "two", "deep", "dicts", "non", "-", "destructively" ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/utils.py#L49-L78
openxc/openxc-python
openxc/generator/xml_to_json.py
XMLBackedSignal.from_xml_node
def from_xml_node(cls, node): """Construct a Signal instance from an XML node exported from a Vector CANoe .dbc file.""" return cls(name=node.find("Name").text, bit_position=int(node.find("Bitposition").text), bit_size=int(node.find("Bitsize").text), ...
python
def from_xml_node(cls, node): """Construct a Signal instance from an XML node exported from a Vector CANoe .dbc file.""" return cls(name=node.find("Name").text, bit_position=int(node.find("Bitposition").text), bit_size=int(node.find("Bitsize").text), ...
[ "def", "from_xml_node", "(", "cls", ",", "node", ")", ":", "return", "cls", "(", "name", "=", "node", ".", "find", "(", "\"Name\"", ")", ".", "text", ",", "bit_position", "=", "int", "(", "node", ".", "find", "(", "\"Bitposition\"", ")", ".", "text",...
Construct a Signal instance from an XML node exported from a Vector CANoe .dbc file.
[ "Construct", "a", "Signal", "instance", "from", "an", "XML", "node", "exported", "from", "a", "Vector", "CANoe", ".", "dbc", "file", "." ]
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/generator/xml_to_json.py#L62-L71
openxc/openxc-python
openxc/sources/base.py
SourceLogger.run
def run(self): """Continuously read data from the source and attempt to parse a valid message from the buffer of bytes. When a message is parsed, passes it off to the callback if one is set. """ message_buffer = b"" while self.running: try: mes...
python
def run(self): """Continuously read data from the source and attempt to parse a valid message from the buffer of bytes. When a message is parsed, passes it off to the callback if one is set. """ message_buffer = b"" while self.running: try: mes...
[ "def", "run", "(", "self", ")", ":", "message_buffer", "=", "b\"\"", "while", "self", ".", "running", ":", "try", ":", "message_buffer", "+=", "self", ".", "source", ".", "read_logs", "(", ")", "except", "DataSourceError", "as", "e", ":", "if", "self", ...
Continuously read data from the source and attempt to parse a valid message from the buffer of bytes. When a message is parsed, passes it off to the callback if one is set.
[ "Continuously", "read", "data", "from", "the", "source", "and", "attempt", "to", "parse", "a", "valid", "message", "from", "the", "buffer", "of", "bytes", ".", "When", "a", "message", "is", "parsed", "passes", "it", "off", "to", "the", "callback", "if", ...
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/sources/base.py#L141-L163
openxc/openxc-python
fabfile.py
compare_versions
def compare_versions(x, y): """ Expects 2 strings in the format of 'X.Y.Z' where X, Y and Z are integers. It will compare the items which will organize things properly by their major, minor and bugfix version. :: >>> my_list = ['v1.13', 'v1.14.2', 'v1.14.1', 'v1.9', 'v1.1'] >>> sort...
python
def compare_versions(x, y): """ Expects 2 strings in the format of 'X.Y.Z' where X, Y and Z are integers. It will compare the items which will organize things properly by their major, minor and bugfix version. :: >>> my_list = ['v1.13', 'v1.14.2', 'v1.14.1', 'v1.9', 'v1.1'] >>> sort...
[ "def", "compare_versions", "(", "x", ",", "y", ")", ":", "def", "version_to_tuple", "(", "version", ")", ":", "# Trim off the leading v", "version_list", "=", "version", "[", "1", ":", "]", ".", "split", "(", "'.'", ",", "2", ")", "if", "len", "(", "ve...
Expects 2 strings in the format of 'X.Y.Z' where X, Y and Z are integers. It will compare the items which will organize things properly by their major, minor and bugfix version. :: >>> my_list = ['v1.13', 'v1.14.2', 'v1.14.1', 'v1.9', 'v1.1'] >>> sorted(my_list, cmp=compare_versions) ...
[ "Expects", "2", "strings", "in", "the", "format", "of", "X", ".", "Y", ".", "Z", "where", "X", "Y", "and", "Z", "are", "integers", ".", "It", "will", "compare", "the", "items", "which", "will", "organize", "things", "properly", "by", "their", "major", ...
train
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/fabfile.py#L36-L61
dfm/celerite
celerite/celerite.py
GP.compute
def compute(self, t, yerr=1.123e-12, check_sorted=True, A=None, U=None, V=None): """ Compute the extended form of the covariance matrix and factorize Args: x (array[n]): The independent coordinates of the data points. This array must be _sorted_ in as...
python
def compute(self, t, yerr=1.123e-12, check_sorted=True, A=None, U=None, V=None): """ Compute the extended form of the covariance matrix and factorize Args: x (array[n]): The independent coordinates of the data points. This array must be _sorted_ in as...
[ "def", "compute", "(", "self", ",", "t", ",", "yerr", "=", "1.123e-12", ",", "check_sorted", "=", "True", ",", "A", "=", "None", ",", "U", "=", "None", ",", "V", "=", "None", ")", ":", "t", "=", "np", ".", "atleast_1d", "(", "t", ")", "if", "...
Compute the extended form of the covariance matrix and factorize Args: x (array[n]): The independent coordinates of the data points. This array must be _sorted_ in ascending order. yerr (Optional[float or array[n]]): The measurement uncertainties for the ...
[ "Compute", "the", "extended", "form", "of", "the", "covariance", "matrix", "and", "factorize" ]
train
https://github.com/dfm/celerite/blob/ad3f471f06b18d233f3dab71bb1c20a316173cae/celerite/celerite.py#L97-L139
dfm/celerite
celerite/celerite.py
GP.log_likelihood
def log_likelihood(self, y, _const=math.log(2.0*math.pi), quiet=False): """ Compute the marginalized likelihood of the GP model The factorized matrix from the previous call to :func:`GP.compute` is used so ``compute`` must be called first. Args: y (array[n]): The ob...
python
def log_likelihood(self, y, _const=math.log(2.0*math.pi), quiet=False): """ Compute the marginalized likelihood of the GP model The factorized matrix from the previous call to :func:`GP.compute` is used so ``compute`` must be called first. Args: y (array[n]): The ob...
[ "def", "log_likelihood", "(", "self", ",", "y", ",", "_const", "=", "math", ".", "log", "(", "2.0", "*", "math", ".", "pi", ")", ",", "quiet", "=", "False", ")", ":", "y", "=", "self", ".", "_process_input", "(", "y", ")", "resid", "=", "y", "-...
Compute the marginalized likelihood of the GP model The factorized matrix from the previous call to :func:`GP.compute` is used so ``compute`` must be called first. Args: y (array[n]): The observations at coordinates ``x`` from :func:`GP.compute`. quiet (...
[ "Compute", "the", "marginalized", "likelihood", "of", "the", "GP", "model" ]
train
https://github.com/dfm/celerite/blob/ad3f471f06b18d233f3dab71bb1c20a316173cae/celerite/celerite.py#L155-L192
dfm/celerite
celerite/celerite.py
GP.grad_log_likelihood
def grad_log_likelihood(self, y, quiet=False): """ Compute the gradient of the marginalized likelihood The factorized matrix from the previous call to :func:`GP.compute` is used so ``compute`` must be called first. The gradient is taken with respect to the parameters returned by...
python
def grad_log_likelihood(self, y, quiet=False): """ Compute the gradient of the marginalized likelihood The factorized matrix from the previous call to :func:`GP.compute` is used so ``compute`` must be called first. The gradient is taken with respect to the parameters returned by...
[ "def", "grad_log_likelihood", "(", "self", ",", "y", ",", "quiet", "=", "False", ")", ":", "if", "not", "solver", ".", "has_autodiff", "(", ")", ":", "raise", "RuntimeError", "(", "\"celerite must be compiled with autodiff \"", "\"support to use the gradient methods\"...
Compute the gradient of the marginalized likelihood The factorized matrix from the previous call to :func:`GP.compute` is used so ``compute`` must be called first. The gradient is taken with respect to the parameters returned by :func:`GP.get_parameter_vector`. This function requires th...
[ "Compute", "the", "gradient", "of", "the", "marginalized", "likelihood" ]
train
https://github.com/dfm/celerite/blob/ad3f471f06b18d233f3dab71bb1c20a316173cae/celerite/celerite.py#L194-L263
dfm/celerite
celerite/celerite.py
GP.apply_inverse
def apply_inverse(self, y): """ Apply the inverse of the covariance matrix to a vector or matrix Solve ``K.x = y`` for ``x`` where ``K`` is the covariance matrix of the GP with the white noise and ``yerr`` components included on the diagonal. Args: y (array[...
python
def apply_inverse(self, y): """ Apply the inverse of the covariance matrix to a vector or matrix Solve ``K.x = y`` for ``x`` where ``K`` is the covariance matrix of the GP with the white noise and ``yerr`` components included on the diagonal. Args: y (array[...
[ "def", "apply_inverse", "(", "self", ",", "y", ")", ":", "self", ".", "_recompute", "(", ")", "return", "self", ".", "solver", ".", "solve", "(", "self", ".", "_process_input", "(", "y", ")", ")" ]
Apply the inverse of the covariance matrix to a vector or matrix Solve ``K.x = y`` for ``x`` where ``K`` is the covariance matrix of the GP with the white noise and ``yerr`` components included on the diagonal. Args: y (array[n] or array[n, nrhs]): The vector or matrix ``y`...
[ "Apply", "the", "inverse", "of", "the", "covariance", "matrix", "to", "a", "vector", "or", "matrix" ]
train
https://github.com/dfm/celerite/blob/ad3f471f06b18d233f3dab71bb1c20a316173cae/celerite/celerite.py#L265-L286
dfm/celerite
celerite/celerite.py
GP.dot
def dot(self, y, t=None, A=None, U=None, V=None, kernel=None, check_sorted=True): """ Dot the covariance matrix into a vector or matrix Compute ``K.y`` where ``K`` is the covariance matrix of the GP without the white noise or ``yerr`` values on the diagonal. Args: ...
python
def dot(self, y, t=None, A=None, U=None, V=None, kernel=None, check_sorted=True): """ Dot the covariance matrix into a vector or matrix Compute ``K.y`` where ``K`` is the covariance matrix of the GP without the white noise or ``yerr`` values on the diagonal. Args: ...
[ "def", "dot", "(", "self", ",", "y", ",", "t", "=", "None", ",", "A", "=", "None", ",", "U", "=", "None", ",", "V", "=", "None", ",", "kernel", "=", "None", ",", "check_sorted", "=", "True", ")", ":", "if", "kernel", "is", "None", ":", "kerne...
Dot the covariance matrix into a vector or matrix Compute ``K.y`` where ``K`` is the covariance matrix of the GP without the white noise or ``yerr`` values on the diagonal. Args: y (array[n] or array[n, nrhs]): The vector or matrix ``y`` described above. ...
[ "Dot", "the", "covariance", "matrix", "into", "a", "vector", "or", "matrix" ]
train
https://github.com/dfm/celerite/blob/ad3f471f06b18d233f3dab71bb1c20a316173cae/celerite/celerite.py#L288-L341
dfm/celerite
celerite/celerite.py
GP.predict
def predict(self, y, t=None, return_cov=True, return_var=False): """ Compute the conditional predictive distribution of the model You must call :func:`GP.compute` before this method. Args: y (array[n]): The observations at coordinates ``x`` from :func:`GP.co...
python
def predict(self, y, t=None, return_cov=True, return_var=False): """ Compute the conditional predictive distribution of the model You must call :func:`GP.compute` before this method. Args: y (array[n]): The observations at coordinates ``x`` from :func:`GP.co...
[ "def", "predict", "(", "self", ",", "y", ",", "t", "=", "None", ",", "return_cov", "=", "True", ",", "return_var", "=", "False", ")", ":", "y", "=", "self", ".", "_process_input", "(", "y", ")", "if", "len", "(", "y", ".", "shape", ")", ">", "1...
Compute the conditional predictive distribution of the model You must call :func:`GP.compute` before this method. Args: y (array[n]): The observations at coordinates ``x`` from :func:`GP.compute`. t (Optional[array[ntest]]): The independent coordinates where the...
[ "Compute", "the", "conditional", "predictive", "distribution", "of", "the", "model" ]
train
https://github.com/dfm/celerite/blob/ad3f471f06b18d233f3dab71bb1c20a316173cae/celerite/celerite.py#L343-L418
dfm/celerite
celerite/celerite.py
GP.get_matrix
def get_matrix(self, x1=None, x2=None, include_diagonal=None, include_general=None): """ Get the covariance matrix at given independent coordinates Args: x1 (Optional[array[n1]]): The first set of independent coordinates. If this is omitted, ``x1``...
python
def get_matrix(self, x1=None, x2=None, include_diagonal=None, include_general=None): """ Get the covariance matrix at given independent coordinates Args: x1 (Optional[array[n1]]): The first set of independent coordinates. If this is omitted, ``x1``...
[ "def", "get_matrix", "(", "self", ",", "x1", "=", "None", ",", "x2", "=", "None", ",", "include_diagonal", "=", "None", ",", "include_general", "=", "None", ")", ":", "if", "x1", "is", "None", "and", "x2", "is", "None", ":", "if", "self", ".", "_t"...
Get the covariance matrix at given independent coordinates Args: x1 (Optional[array[n1]]): The first set of independent coordinates. If this is omitted, ``x1`` will be assumed to be equal to ``x`` from a previous call to :func:`GP.compute`. x2 (Optional[a...
[ "Get", "the", "covariance", "matrix", "at", "given", "independent", "coordinates" ]
train
https://github.com/dfm/celerite/blob/ad3f471f06b18d233f3dab71bb1c20a316173cae/celerite/celerite.py#L420-L459
dfm/celerite
celerite/celerite.py
GP.sample
def sample(self, size=None): """ Sample from the prior distribution over datasets Args: size (Optional[int]): The number of samples to draw. Returns: array[n] or array[size, n]: The samples from the prior distribution over datasets. """ ...
python
def sample(self, size=None): """ Sample from the prior distribution over datasets Args: size (Optional[int]): The number of samples to draw. Returns: array[n] or array[size, n]: The samples from the prior distribution over datasets. """ ...
[ "def", "sample", "(", "self", ",", "size", "=", "None", ")", ":", "self", ".", "_recompute", "(", ")", "if", "size", "is", "None", ":", "n", "=", "np", ".", "random", ".", "randn", "(", "len", "(", "self", ".", "_t", ")", ")", "else", ":", "n...
Sample from the prior distribution over datasets Args: size (Optional[int]): The number of samples to draw. Returns: array[n] or array[size, n]: The samples from the prior distribution over datasets.
[ "Sample", "from", "the", "prior", "distribution", "over", "datasets" ]
train
https://github.com/dfm/celerite/blob/ad3f471f06b18d233f3dab71bb1c20a316173cae/celerite/celerite.py#L461-L481
dfm/celerite
celerite/celerite.py
GP.sample_conditional
def sample_conditional(self, y, t=None, size=None): """ Sample from the conditional (predictive) distribution Note: this method scales as ``O(M^3)`` for large ``M``, where ``M == len(t)``. Args: y (array[n]): The observations at coordinates ``x`` from ...
python
def sample_conditional(self, y, t=None, size=None): """ Sample from the conditional (predictive) distribution Note: this method scales as ``O(M^3)`` for large ``M``, where ``M == len(t)``. Args: y (array[n]): The observations at coordinates ``x`` from ...
[ "def", "sample_conditional", "(", "self", ",", "y", ",", "t", "=", "None", ",", "size", "=", "None", ")", ":", "mu", ",", "cov", "=", "self", ".", "predict", "(", "y", ",", "t", ",", "return_cov", "=", "True", ")", "return", "np", ".", "random", ...
Sample from the conditional (predictive) distribution Note: this method scales as ``O(M^3)`` for large ``M``, where ``M == len(t)``. Args: y (array[n]): The observations at coordinates ``x`` from :func:`GP.compute`. t (Optional[array[ntest]]): The indepe...
[ "Sample", "from", "the", "conditional", "(", "predictive", ")", "distribution" ]
train
https://github.com/dfm/celerite/blob/ad3f471f06b18d233f3dab71bb1c20a316173cae/celerite/celerite.py#L483-L505
dfm/celerite
celerite/terms.py
Term.get_value
def get_value(self, tau): """ Compute the value of the term for an array of lags Args: tau (array[...]): An array of lags where the term should be evaluated. Returns: The value of the term for each ``tau``. This will have the same sha...
python
def get_value(self, tau): """ Compute the value of the term for an array of lags Args: tau (array[...]): An array of lags where the term should be evaluated. Returns: The value of the term for each ``tau``. This will have the same sha...
[ "def", "get_value", "(", "self", ",", "tau", ")", ":", "tau", "=", "np", ".", "asarray", "(", "tau", ")", "(", "alpha_real", ",", "beta_real", ",", "alpha_complex_real", ",", "alpha_complex_imag", ",", "beta_complex_real", ",", "beta_complex_imag", ")", "=",...
Compute the value of the term for an array of lags Args: tau (array[...]): An array of lags where the term should be evaluated. Returns: The value of the term for each ``tau``. This will have the same shape as ``tau``.
[ "Compute", "the", "value", "of", "the", "term", "for", "an", "array", "of", "lags" ]
train
https://github.com/dfm/celerite/blob/ad3f471f06b18d233f3dab71bb1c20a316173cae/celerite/terms.py#L43-L65
dfm/celerite
celerite/terms.py
Term.get_psd
def get_psd(self, omega): """ Compute the PSD of the term for an array of angular frequencies Args: omega (array[...]): An array of frequencies where the PSD should be evaluated. Returns: The value of the PSD for each ``omega``. This will have th...
python
def get_psd(self, omega): """ Compute the PSD of the term for an array of angular frequencies Args: omega (array[...]): An array of frequencies where the PSD should be evaluated. Returns: The value of the PSD for each ``omega``. This will have th...
[ "def", "get_psd", "(", "self", ",", "omega", ")", ":", "w", "=", "np", ".", "asarray", "(", "omega", ")", "(", "alpha_real", ",", "beta_real", ",", "alpha_complex_real", ",", "alpha_complex_imag", ",", "beta_complex_real", ",", "beta_complex_imag", ")", "=",...
Compute the PSD of the term for an array of angular frequencies Args: omega (array[...]): An array of frequencies where the PSD should be evaluated. Returns: The value of the PSD for each ``omega``. This will have the same shape as ``omega``.
[ "Compute", "the", "PSD", "of", "the", "term", "for", "an", "array", "of", "angular", "frequencies" ]
train
https://github.com/dfm/celerite/blob/ad3f471f06b18d233f3dab71bb1c20a316173cae/celerite/terms.py#L67-L89
dfm/celerite
celerite/terms.py
Term.get_complex_coefficients
def get_complex_coefficients(self, params): """ Get the arrays ``alpha_complex_*`` and ``beta_complex_*`` This method should be overloaded by subclasses to return the arrays ``alpha_complex_real``, ``alpha_complex_imag``, ``beta_complex_real``, and ``beta_complex_imag`` given th...
python
def get_complex_coefficients(self, params): """ Get the arrays ``alpha_complex_*`` and ``beta_complex_*`` This method should be overloaded by subclasses to return the arrays ``alpha_complex_real``, ``alpha_complex_imag``, ``beta_complex_real``, and ``beta_complex_imag`` given th...
[ "def", "get_complex_coefficients", "(", "self", ",", "params", ")", ":", "return", "np", ".", "empty", "(", "0", ")", ",", "np", ".", "empty", "(", "0", ")", ",", "np", ".", "empty", "(", "0", ")", ",", "np", ".", "empty", "(", "0", ")" ]
Get the arrays ``alpha_complex_*`` and ``beta_complex_*`` This method should be overloaded by subclasses to return the arrays ``alpha_complex_real``, ``alpha_complex_imag``, ``beta_complex_real``, and ``beta_complex_imag`` given the current parameter settings. By default, this term is e...
[ "Get", "the", "arrays", "alpha_complex_", "*", "and", "beta_complex_", "*" ]
train
https://github.com/dfm/celerite/blob/ad3f471f06b18d233f3dab71bb1c20a316173cae/celerite/terms.py#L128-L145
dfm/celerite
celerite/terms.py
Term.coefficients
def coefficients(self): """ All of the coefficient arrays This property is the concatenation of the results from :func:`terms.Term.get_real_coefficients` and :func:`terms.Term.get_complex_coefficients` but it will always return a tuple of length 6, even if ``alpha_comple...
python
def coefficients(self): """ All of the coefficient arrays This property is the concatenation of the results from :func:`terms.Term.get_real_coefficients` and :func:`terms.Term.get_complex_coefficients` but it will always return a tuple of length 6, even if ``alpha_comple...
[ "def", "coefficients", "(", "self", ")", ":", "vector", "=", "self", ".", "get_parameter_vector", "(", "include_frozen", "=", "True", ")", "pars", "=", "self", ".", "get_all_coefficients", "(", "vector", ")", "if", "len", "(", "pars", ")", "!=", "6", ":"...
All of the coefficient arrays This property is the concatenation of the results from :func:`terms.Term.get_real_coefficients` and :func:`terms.Term.get_complex_coefficients` but it will always return a tuple of length 6, even if ``alpha_complex_imag`` was omitted from ``get_comp...
[ "All", "of", "the", "coefficient", "arrays" ]
train
https://github.com/dfm/celerite/blob/ad3f471f06b18d233f3dab71bb1c20a316173cae/celerite/terms.py#L157-L188
shoyer/h5netcdf
h5netcdf/_chainmap.py
ChainMap.pop
def pop(self, key, *args): 'Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].' try: return self.maps[0].pop(key, *args) except KeyError: raise KeyError('Key not found in the first mapping: {!r}'.format(key))
python
def pop(self, key, *args): 'Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].' try: return self.maps[0].pop(key, *args) except KeyError: raise KeyError('Key not found in the first mapping: {!r}'.format(key))
[ "def", "pop", "(", "self", ",", "key", ",", "*", "args", ")", ":", "try", ":", "return", "self", ".", "maps", "[", "0", "]", ".", "pop", "(", "key", ",", "*", "args", ")", "except", "KeyError", ":", "raise", "KeyError", "(", "'Key not found in the ...
Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].
[ "Remove", "*", "key", "*", "from", "maps", "[", "0", "]", "and", "return", "its", "value", ".", "Raise", "KeyError", "if", "*", "key", "*", "not", "in", "maps", "[", "0", "]", "." ]
train
https://github.com/shoyer/h5netcdf/blob/3ae35cd58297281a1dc69c46fb0b315a0007ac2b/h5netcdf/_chainmap.py#L131-L136
shoyer/h5netcdf
h5netcdf/core.py
Group._determine_current_dimension_size
def _determine_current_dimension_size(self, dim_name, max_size): """ Helper method to determine the current size of a dimension. """ # Limited dimension. if self.dimensions[dim_name] is not None: return max_size def _find_dim(h5group, dim): if dim...
python
def _determine_current_dimension_size(self, dim_name, max_size): """ Helper method to determine the current size of a dimension. """ # Limited dimension. if self.dimensions[dim_name] is not None: return max_size def _find_dim(h5group, dim): if dim...
[ "def", "_determine_current_dimension_size", "(", "self", ",", "dim_name", ",", "max_size", ")", ":", "# Limited dimension.", "if", "self", ".", "dimensions", "[", "dim_name", "]", "is", "not", "None", ":", "return", "max_size", "def", "_find_dim", "(", "h5group"...
Helper method to determine the current size of a dimension.
[ "Helper", "method", "to", "determine", "the", "current", "size", "of", "a", "dimension", "." ]
train
https://github.com/shoyer/h5netcdf/blob/3ae35cd58297281a1dc69c46fb0b315a0007ac2b/h5netcdf/core.py#L273-L300
shoyer/h5netcdf
h5netcdf/core.py
Group._create_dim_scales
def _create_dim_scales(self): """Create all necessary HDF5 dimension scale.""" dim_order = self._dim_order.maps[0] for dim in sorted(dim_order, key=lambda d: dim_order[d]): if dim not in self._h5group: size = self._current_dim_sizes[dim] kwargs = {} ...
python
def _create_dim_scales(self): """Create all necessary HDF5 dimension scale.""" dim_order = self._dim_order.maps[0] for dim in sorted(dim_order, key=lambda d: dim_order[d]): if dim not in self._h5group: size = self._current_dim_sizes[dim] kwargs = {} ...
[ "def", "_create_dim_scales", "(", "self", ")", ":", "dim_order", "=", "self", ".", "_dim_order", ".", "maps", "[", "0", "]", "for", "dim", "in", "sorted", "(", "dim_order", ",", "key", "=", "lambda", "d", ":", "dim_order", "[", "d", "]", ")", ":", ...
Create all necessary HDF5 dimension scale.
[ "Create", "all", "necessary", "HDF5", "dimension", "scale", "." ]
train
https://github.com/shoyer/h5netcdf/blob/3ae35cd58297281a1dc69c46fb0b315a0007ac2b/h5netcdf/core.py#L459-L483
shoyer/h5netcdf
h5netcdf/core.py
Group._attach_dim_scales
def _attach_dim_scales(self): """Attach dimension scales to all variables.""" for name, var in self.variables.items(): if name not in self.dimensions: for n, dim in enumerate(var.dimensions): var._h5ds.dims[n].attach_scale(self._all_h5groups[dim]) ...
python
def _attach_dim_scales(self): """Attach dimension scales to all variables.""" for name, var in self.variables.items(): if name not in self.dimensions: for n, dim in enumerate(var.dimensions): var._h5ds.dims[n].attach_scale(self._all_h5groups[dim]) ...
[ "def", "_attach_dim_scales", "(", "self", ")", ":", "for", "name", ",", "var", "in", "self", ".", "variables", ".", "items", "(", ")", ":", "if", "name", "not", "in", "self", ".", "dimensions", ":", "for", "n", ",", "dim", "in", "enumerate", "(", "...
Attach dimension scales to all variables.
[ "Attach", "dimension", "scales", "to", "all", "variables", "." ]
train
https://github.com/shoyer/h5netcdf/blob/3ae35cd58297281a1dc69c46fb0b315a0007ac2b/h5netcdf/core.py#L485-L493
shoyer/h5netcdf
h5netcdf/core.py
Group._detach_dim_scale
def _detach_dim_scale(self, name): """Detach the dimension scale corresponding to a dimension name.""" for var in self.variables.values(): for n, dim in enumerate(var.dimensions): if dim == name: var._h5ds.dims[n].detach_scale(self._all_h5groups[dim]) ...
python
def _detach_dim_scale(self, name): """Detach the dimension scale corresponding to a dimension name.""" for var in self.variables.values(): for n, dim in enumerate(var.dimensions): if dim == name: var._h5ds.dims[n].detach_scale(self._all_h5groups[dim]) ...
[ "def", "_detach_dim_scale", "(", "self", ",", "name", ")", ":", "for", "var", "in", "self", ".", "variables", ".", "values", "(", ")", ":", "for", "n", ",", "dim", "in", "enumerate", "(", "var", ".", "dimensions", ")", ":", "if", "dim", "==", "name...
Detach the dimension scale corresponding to a dimension name.
[ "Detach", "the", "dimension", "scale", "corresponding", "to", "a", "dimension", "name", "." ]
train
https://github.com/shoyer/h5netcdf/blob/3ae35cd58297281a1dc69c46fb0b315a0007ac2b/h5netcdf/core.py#L495-L504
shoyer/h5netcdf
h5netcdf/core.py
Group.resize_dimension
def resize_dimension(self, dimension, size): """ Resize a dimension to a certain size. It will pad with the underlying HDF5 data sets' fill values (usually zero) where necessary. """ if self.dimensions[dimension] is not None: raise ValueError("Dimension '%s' ...
python
def resize_dimension(self, dimension, size): """ Resize a dimension to a certain size. It will pad with the underlying HDF5 data sets' fill values (usually zero) where necessary. """ if self.dimensions[dimension] is not None: raise ValueError("Dimension '%s' ...
[ "def", "resize_dimension", "(", "self", ",", "dimension", ",", "size", ")", ":", "if", "self", ".", "dimensions", "[", "dimension", "]", "is", "not", "None", ":", "raise", "ValueError", "(", "\"Dimension '%s' is not unlimited and thus \"", "\"cannot be resized.\"", ...
Resize a dimension to a certain size. It will pad with the underlying HDF5 data sets' fill values (usually zero) where necessary.
[ "Resize", "a", "dimension", "to", "a", "certain", "size", "." ]
train
https://github.com/shoyer/h5netcdf/blob/3ae35cd58297281a1dc69c46fb0b315a0007ac2b/h5netcdf/core.py#L550-L575
vijayvarma392/surfinBH
surfinBH/_utils.py
multiplyQuats
def multiplyQuats(q1, q2): """q1, q2 must be [scalar, x, y, z] but those may be arrays or scalars""" return np.array([ q1[0]*q2[0] - q1[1]*q2[1] - q1[2]*q2[2] - q1[3]*q2[3], q1[2]*q2[3] - q2[2]*q1[3] + q1[0]*q2[1] + q2[0]*q1[1], q1[3]*q2[1] - q2[3]*q1[1] + q1[0]*q2[2] + q2[0]...
python
def multiplyQuats(q1, q2): """q1, q2 must be [scalar, x, y, z] but those may be arrays or scalars""" return np.array([ q1[0]*q2[0] - q1[1]*q2[1] - q1[2]*q2[2] - q1[3]*q2[3], q1[2]*q2[3] - q2[2]*q1[3] + q1[0]*q2[1] + q2[0]*q1[1], q1[3]*q2[1] - q2[3]*q1[1] + q1[0]*q2[2] + q2[0]...
[ "def", "multiplyQuats", "(", "q1", ",", "q2", ")", ":", "return", "np", ".", "array", "(", "[", "q1", "[", "0", "]", "*", "q2", "[", "0", "]", "-", "q1", "[", "1", "]", "*", "q2", "[", "1", "]", "-", "q1", "[", "2", "]", "*", "q2", "[",...
q1, q2 must be [scalar, x, y, z] but those may be arrays or scalars
[ "q1", "q2", "must", "be", "[", "scalar", "x", "y", "z", "]", "but", "those", "may", "be", "arrays", "or", "scalars" ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_utils.py#L4-L10
vijayvarma392/surfinBH
surfinBH/_utils.py
quatInv
def quatInv(q): """Returns QBar such that Q*QBar = 1""" qConj = -q qConj[0] = -qConj[0] normSqr = multiplyQuats(q, qConj)[0] return qConj/normSqr
python
def quatInv(q): """Returns QBar such that Q*QBar = 1""" qConj = -q qConj[0] = -qConj[0] normSqr = multiplyQuats(q, qConj)[0] return qConj/normSqr
[ "def", "quatInv", "(", "q", ")", ":", "qConj", "=", "-", "q", "qConj", "[", "0", "]", "=", "-", "qConj", "[", "0", "]", "normSqr", "=", "multiplyQuats", "(", "q", ",", "qConj", ")", "[", "0", "]", "return", "qConj", "/", "normSqr" ]
Returns QBar such that Q*QBar = 1
[ "Returns", "QBar", "such", "that", "Q", "*", "QBar", "=", "1" ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_utils.py#L13-L18
vijayvarma392/surfinBH
surfinBH/_utils.py
alignVec_quat
def alignVec_quat(vec): """Returns a unit quaternion that will align vec with the z-axis""" alpha = np.arctan2(vec[1], vec[0]) beta = np.arccos(vec[2]) gamma = -alpha*vec[2] cb = np.cos(0.5*beta) sb = np.sin(0.5*beta) return np.array([cb*np.cos(0.5*(alpha + gamma)), sb*n...
python
def alignVec_quat(vec): """Returns a unit quaternion that will align vec with the z-axis""" alpha = np.arctan2(vec[1], vec[0]) beta = np.arccos(vec[2]) gamma = -alpha*vec[2] cb = np.cos(0.5*beta) sb = np.sin(0.5*beta) return np.array([cb*np.cos(0.5*(alpha + gamma)), sb*n...
[ "def", "alignVec_quat", "(", "vec", ")", ":", "alpha", "=", "np", ".", "arctan2", "(", "vec", "[", "1", "]", ",", "vec", "[", "0", "]", ")", "beta", "=", "np", ".", "arccos", "(", "vec", "[", "2", "]", ")", "gamma", "=", "-", "alpha", "*", ...
Returns a unit quaternion that will align vec with the z-axis
[ "Returns", "a", "unit", "quaternion", "that", "will", "align", "vec", "with", "the", "z", "-", "axis" ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_utils.py#L21-L31
vijayvarma392/surfinBH
surfinBH/_utils.py
transformTimeDependentVector
def transformTimeDependentVector(quat, vec, inverse=0): """Given (for example) a minimal rotation frame quat, transforms vec from the minimal rotation frame to the inertial frame. With inverse=1, transforms from the inertial frame to the minimal rotation frame.""" qInv = quatInv(quat) if inverse...
python
def transformTimeDependentVector(quat, vec, inverse=0): """Given (for example) a minimal rotation frame quat, transforms vec from the minimal rotation frame to the inertial frame. With inverse=1, transforms from the inertial frame to the minimal rotation frame.""" qInv = quatInv(quat) if inverse...
[ "def", "transformTimeDependentVector", "(", "quat", ",", "vec", ",", "inverse", "=", "0", ")", ":", "qInv", "=", "quatInv", "(", "quat", ")", "if", "inverse", ":", "return", "transformTimeDependentVector", "(", "qInv", ",", "vec", ",", "inverse", "=", "0",...
Given (for example) a minimal rotation frame quat, transforms vec from the minimal rotation frame to the inertial frame. With inverse=1, transforms from the inertial frame to the minimal rotation frame.
[ "Given", "(", "for", "example", ")", "a", "minimal", "rotation", "frame", "quat", "transforms", "vec", "from", "the", "minimal", "rotation", "frame", "to", "the", "inertial", "frame", ".", "With", "inverse", "=", "1", "transforms", "from", "the", "inertial",...
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_utils.py#L40-L50
vijayvarma392/surfinBH
surfinBH/_utils.py
rotate_in_plane
def rotate_in_plane(chi, phase): """For transforming spins between the coprecessing and coorbital frames""" v = chi.T sp = np.sin(phase) cp = np.cos(phase) res = 1.*v res[0] = v[0]*cp + v[1]*sp res[1] = v[1]*cp - v[0]*sp return res.T
python
def rotate_in_plane(chi, phase): """For transforming spins between the coprecessing and coorbital frames""" v = chi.T sp = np.sin(phase) cp = np.cos(phase) res = 1.*v res[0] = v[0]*cp + v[1]*sp res[1] = v[1]*cp - v[0]*sp return res.T
[ "def", "rotate_in_plane", "(", "chi", ",", "phase", ")", ":", "v", "=", "chi", ".", "T", "sp", "=", "np", ".", "sin", "(", "phase", ")", "cp", "=", "np", ".", "cos", "(", "phase", ")", "res", "=", "1.", "*", "v", "res", "[", "0", "]", "=", ...
For transforming spins between the coprecessing and coorbital frames
[ "For", "transforming", "spins", "between", "the", "coprecessing", "and", "coorbital", "frames" ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_utils.py#L54-L62
vijayvarma392/surfinBH
surfinBH/_utils.py
transform_vector_coorb_to_inertial
def transform_vector_coorb_to_inertial(vec_coorb, orbPhase, quat_copr): """Given a vector (of size 3) in coorbital frame, orbital phase in coprecessing frame and a minimal rotation frame quat, transforms the vector from the coorbital to the inertial frame. """ # Transform to coprecessing frame ...
python
def transform_vector_coorb_to_inertial(vec_coorb, orbPhase, quat_copr): """Given a vector (of size 3) in coorbital frame, orbital phase in coprecessing frame and a minimal rotation frame quat, transforms the vector from the coorbital to the inertial frame. """ # Transform to coprecessing frame ...
[ "def", "transform_vector_coorb_to_inertial", "(", "vec_coorb", ",", "orbPhase", ",", "quat_copr", ")", ":", "# Transform to coprecessing frame", "vec_copr", "=", "rotate_in_plane", "(", "vec_coorb", ",", "-", "orbPhase", ")", "# Transform to inertial frame", "vec", "=", ...
Given a vector (of size 3) in coorbital frame, orbital phase in coprecessing frame and a minimal rotation frame quat, transforms the vector from the coorbital to the inertial frame.
[ "Given", "a", "vector", "(", "of", "size", "3", ")", "in", "coorbital", "frame", "orbital", "phase", "in", "coprecessing", "frame", "and", "a", "minimal", "rotation", "frame", "quat", "transforms", "the", "vector", "from", "the", "coorbital", "to", "the", ...
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_utils.py#L65-L78
vijayvarma392/surfinBH
surfinBH/_utils.py
transform_error_coorb_to_inertial
def transform_error_coorb_to_inertial(vec_coorb, vec_err_coorb, orbPhase, quat_copr): """ Transform error in a vector from the coorbital frame to the inertial frame. Generates distributions in the coorbital frame, transforms them to inertial frame and returns 1-simga widths in the inertial frame. ...
python
def transform_error_coorb_to_inertial(vec_coorb, vec_err_coorb, orbPhase, quat_copr): """ Transform error in a vector from the coorbital frame to the inertial frame. Generates distributions in the coorbital frame, transforms them to inertial frame and returns 1-simga widths in the inertial frame. ...
[ "def", "transform_error_coorb_to_inertial", "(", "vec_coorb", ",", "vec_err_coorb", ",", "orbPhase", ",", "quat_copr", ")", ":", "# for reproducibility", "np", ".", "random", ".", "seed", "(", "0", ")", "# Get distribution in coorbital frame", "dist_coorb", "=", "np",...
Transform error in a vector from the coorbital frame to the inertial frame. Generates distributions in the coorbital frame, transforms them to inertial frame and returns 1-simga widths in the inertial frame.
[ "Transform", "error", "in", "a", "vector", "from", "the", "coorbital", "frame", "to", "the", "inertial", "frame", ".", "Generates", "distributions", "in", "the", "coorbital", "frame", "transforms", "them", "to", "inertial", "frame", "and", "returns", "1", "-",...
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_utils.py#L81-L105
vijayvarma392/surfinBH
surfinBH/_fit_evaluators/fit_7dq2.py
Fit7dq2._load_fits
def _load_fits(self, h5file): """ Loads fits from h5file and returns a dictionary of fits. """ fits = {} for key in ['mf']: fits[key] = self._load_scalar_fit(fit_key=key, h5file=h5file) for key in ['chif', 'vf']: fits[key] = self._load_vector_fit(key, h5file) ...
python
def _load_fits(self, h5file): """ Loads fits from h5file and returns a dictionary of fits. """ fits = {} for key in ['mf']: fits[key] = self._load_scalar_fit(fit_key=key, h5file=h5file) for key in ['chif', 'vf']: fits[key] = self._load_vector_fit(key, h5file) ...
[ "def", "_load_fits", "(", "self", ",", "h5file", ")", ":", "fits", "=", "{", "}", "for", "key", "in", "[", "'mf'", "]", ":", "fits", "[", "key", "]", "=", "self", ".", "_load_scalar_fit", "(", "fit_key", "=", "key", ",", "h5file", "=", "h5file", ...
Loads fits from h5file and returns a dictionary of fits.
[ "Loads", "fits", "from", "h5file", "and", "returns", "a", "dictionary", "of", "fits", "." ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_fit_evaluators/fit_7dq2.py#L149-L156
vijayvarma392/surfinBH
surfinBH/_fit_evaluators/fit_7dq2.py
Fit7dq2._extra_regression_kwargs
def _extra_regression_kwargs(self): """ List of additional kwargs to use in regression tests. """ # larger than default sometimes needed when extrapolating omega_switch_test = 0.019 extra_args = [] extra_args.append({ 'omega0': 5e-3, 'PN_approxim...
python
def _extra_regression_kwargs(self): """ List of additional kwargs to use in regression tests. """ # larger than default sometimes needed when extrapolating omega_switch_test = 0.019 extra_args = [] extra_args.append({ 'omega0': 5e-3, 'PN_approxim...
[ "def", "_extra_regression_kwargs", "(", "self", ")", ":", "# larger than default sometimes needed when extrapolating", "omega_switch_test", "=", "0.019", "extra_args", "=", "[", "]", "extra_args", ".", "append", "(", "{", "'omega0'", ":", "5e-3", ",", "'PN_approximant'"...
List of additional kwargs to use in regression tests.
[ "List", "of", "additional", "kwargs", "to", "use", "in", "regression", "tests", "." ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_fit_evaluators/fit_7dq2.py#L159-L199
vijayvarma392/surfinBH
surfinBH/_fit_evaluators/fit_7dq2.py
Fit7dq2._get_fit_params
def _get_fit_params(self, x, fit_key): """ Transforms the input parameter to fit parameters for the 7dq2 model. That is, maps from x = [q, chiAx, chiAy, chiAz, chiBx, chiBy, chiBz] fit_params = [np.log(q), chiAx, chiAy, chiHat, chiBx, chiBy, chi_a] chiHat is defined in Eq.(3) of 1508.07253, but...
python
def _get_fit_params(self, x, fit_key): """ Transforms the input parameter to fit parameters for the 7dq2 model. That is, maps from x = [q, chiAx, chiAy, chiAz, chiBx, chiBy, chiBz] fit_params = [np.log(q), chiAx, chiAy, chiHat, chiBx, chiBy, chi_a] chiHat is defined in Eq.(3) of 1508.07253, but...
[ "def", "_get_fit_params", "(", "self", ",", "x", ",", "fit_key", ")", ":", "q", ",", "chiAz", ",", "chiBz", "=", "x", "[", "0", "]", ",", "x", "[", "3", "]", ",", "x", "[", "6", "]", "eta", "=", "q", "/", "(", "1.", "+", "q", ")", "**", ...
Transforms the input parameter to fit parameters for the 7dq2 model. That is, maps from x = [q, chiAx, chiAy, chiAz, chiBx, chiBy, chiBz] fit_params = [np.log(q), chiAx, chiAy, chiHat, chiBx, chiBy, chi_a] chiHat is defined in Eq.(3) of 1508.07253, but with chiAz and chiBz instead of chiA and chiB....
[ "Transforms", "the", "input", "parameter", "to", "fit", "parameters", "for", "the", "7dq2", "model", ".", "That", "is", "maps", "from", "x", "=", "[", "q", "chiAx", "chiAy", "chiAz", "chiBx", "chiBy", "chiBz", "]", "fit_params", "=", "[", "np", ".", "l...
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_fit_evaluators/fit_7dq2.py#L202-L223
vijayvarma392/surfinBH
surfinBH/_fit_evaluators/fit_7dq2.py
Fit7dq2._evolve_spins
def _evolve_spins(self, q, chiA0, chiB0, omega0, PN_approximant, PN_dt, PN_spin0, PN_phase0, omega0_nrsur): """ Evolves spins of the component BHs from an initial orbital frequency = omega0 until t=-100 M from the peak of the waveform. If omega0 < omega0_nrsur, use PN to evolve the s...
python
def _evolve_spins(self, q, chiA0, chiB0, omega0, PN_approximant, PN_dt, PN_spin0, PN_phase0, omega0_nrsur): """ Evolves spins of the component BHs from an initial orbital frequency = omega0 until t=-100 M from the peak of the waveform. If omega0 < omega0_nrsur, use PN to evolve the s...
[ "def", "_evolve_spins", "(", "self", ",", "q", ",", "chiA0", ",", "chiB0", ",", "omega0", ",", "PN_approximant", ",", "PN_dt", ",", "PN_spin0", ",", "PN_phase0", ",", "omega0_nrsur", ")", ":", "if", "omega0", "<", "omega0_nrsur", ":", "# If omega0 is below t...
Evolves spins of the component BHs from an initial orbital frequency = omega0 until t=-100 M from the peak of the waveform. If omega0 < omega0_nrsur, use PN to evolve the spins until orbital frequency = omega0. Then evolves further with the NRSur7dq2 waveform model until t=-100M from the...
[ "Evolves", "spins", "of", "the", "component", "BHs", "from", "an", "initial", "orbital", "frequency", "=", "omega0", "until", "t", "=", "-", "100", "M", "from", "the", "peak", "of", "the", "waveform", ".", "If", "omega0", "<", "omega0_nrsur", "use", "PN"...
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_fit_evaluators/fit_7dq2.py#L226-L295
vijayvarma392/surfinBH
surfinBH/_fit_evaluators/fit_7dq2.py
Fit7dq2._eval_wrapper
def _eval_wrapper(self, fit_key, q, chiA, chiB, **kwargs): """Evaluates the surfinBH7dq2 model. """ chiA = np.array(chiA) chiB = np.array(chiB) # Warn/Exit if extrapolating allow_extrap = kwargs.pop('allow_extrap', False) self._check_param_limits(q, chiA, chiB, a...
python
def _eval_wrapper(self, fit_key, q, chiA, chiB, **kwargs): """Evaluates the surfinBH7dq2 model. """ chiA = np.array(chiA) chiB = np.array(chiB) # Warn/Exit if extrapolating allow_extrap = kwargs.pop('allow_extrap', False) self._check_param_limits(q, chiA, chiB, a...
[ "def", "_eval_wrapper", "(", "self", ",", "fit_key", ",", "q", ",", "chiA", ",", "chiB", ",", "*", "*", "kwargs", ")", ":", "chiA", "=", "np", ".", "array", "(", "chiA", ")", "chiB", "=", "np", ".", "array", "(", "chiB", ")", "# Warn/Exit if extrap...
Evaluates the surfinBH7dq2 model.
[ "Evaluates", "the", "surfinBH7dq2", "model", "." ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_fit_evaluators/fit_7dq2.py#L298-L363
vijayvarma392/surfinBH
surfinBH/_loadFits.py
LoadFits
def LoadFits(name): """ Loads data for a fit. If data is not available, downloads it before loading. """ if name not in fits_collection.keys(): raise Exception('Invalid fit name : %s'%name) else: testPath = DataPath() + '/' + fits_collection[name].data_url.split('/')[-1] if (...
python
def LoadFits(name): """ Loads data for a fit. If data is not available, downloads it before loading. """ if name not in fits_collection.keys(): raise Exception('Invalid fit name : %s'%name) else: testPath = DataPath() + '/' + fits_collection[name].data_url.split('/')[-1] if (...
[ "def", "LoadFits", "(", "name", ")", ":", "if", "name", "not", "in", "fits_collection", ".", "keys", "(", ")", ":", "raise", "Exception", "(", "'Invalid fit name : %s'", "%", "name", ")", "else", ":", "testPath", "=", "DataPath", "(", ")", "+", "'/'", ...
Loads data for a fit. If data is not available, downloads it before loading.
[ "Loads", "data", "for", "a", "fit", ".", "If", "data", "is", "not", "available", "downloads", "it", "before", "loading", "." ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_loadFits.py#L25-L37
vijayvarma392/surfinBH
surfinBH/_loadFits.py
DownloadData
def DownloadData(name='all', data_dir=DataPath()): """ Downloads fit data to DataPath() diretory. If name='all', gets all fit data. """ if name == 'all': for tmp_name in fits_collection.keys(): DownloadData(name=tmp_name, data_dir=data_dir) return if name not in fits...
python
def DownloadData(name='all', data_dir=DataPath()): """ Downloads fit data to DataPath() diretory. If name='all', gets all fit data. """ if name == 'all': for tmp_name in fits_collection.keys(): DownloadData(name=tmp_name, data_dir=data_dir) return if name not in fits...
[ "def", "DownloadData", "(", "name", "=", "'all'", ",", "data_dir", "=", "DataPath", "(", ")", ")", ":", "if", "name", "==", "'all'", ":", "for", "tmp_name", "in", "fits_collection", ".", "keys", "(", ")", ":", "DownloadData", "(", "name", "=", "tmp_nam...
Downloads fit data to DataPath() diretory. If name='all', gets all fit data.
[ "Downloads", "fit", "data", "to", "DataPath", "()", "diretory", ".", "If", "name", "=", "all", "gets", "all", "fit", "data", "." ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_loadFits.py#L40-L62
vijayvarma392/surfinBH
surfinBH/_fit_evaluators/fit_3dq8.py
Fit3dq8._load_fits
def _load_fits(self, h5file): """ Loads fits from h5file and returns a dictionary of fits. """ fits = {} for key in ['mf', 'chifz', 'vfx', 'vfy']: fits[key] = self._load_scalar_fit(fit_key=key, h5file=h5file) return fits
python
def _load_fits(self, h5file): """ Loads fits from h5file and returns a dictionary of fits. """ fits = {} for key in ['mf', 'chifz', 'vfx', 'vfy']: fits[key] = self._load_scalar_fit(fit_key=key, h5file=h5file) return fits
[ "def", "_load_fits", "(", "self", ",", "h5file", ")", ":", "fits", "=", "{", "}", "for", "key", "in", "[", "'mf'", ",", "'chifz'", ",", "'vfx'", ",", "'vfy'", "]", ":", "fits", "[", "key", "]", "=", "self", ".", "_load_scalar_fit", "(", "fit_key", ...
Loads fits from h5file and returns a dictionary of fits.
[ "Loads", "fits", "from", "h5file", "and", "returns", "a", "dictionary", "of", "fits", "." ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_fit_evaluators/fit_3dq8.py#L89-L94
vijayvarma392/surfinBH
surfinBH/_fit_evaluators/fit_3dq8.py
Fit3dq8._eval_wrapper
def _eval_wrapper(self, fit_key, q, chiA, chiB, **kwargs): """ Evaluates the surfinBH3dq8 model. """ chiA = np.array(chiA) chiB = np.array(chiB) # Warn/Exit if extrapolating allow_extrap = kwargs.pop('allow_extrap', False) self._check_param_limits(q, chiA, chiB, ...
python
def _eval_wrapper(self, fit_key, q, chiA, chiB, **kwargs): """ Evaluates the surfinBH3dq8 model. """ chiA = np.array(chiA) chiB = np.array(chiB) # Warn/Exit if extrapolating allow_extrap = kwargs.pop('allow_extrap', False) self._check_param_limits(q, chiA, chiB, ...
[ "def", "_eval_wrapper", "(", "self", ",", "fit_key", ",", "q", ",", "chiA", ",", "chiB", ",", "*", "*", "kwargs", ")", ":", "chiA", "=", "np", ".", "array", "(", "chiA", ")", "chiB", "=", "np", ".", "array", "(", "chiB", ")", "# Warn/Exit if extrap...
Evaluates the surfinBH3dq8 model.
[ "Evaluates", "the", "surfinBH3dq8", "model", "." ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_fit_evaluators/fit_3dq8.py#L112-L143
vijayvarma392/surfinBH
surfinBH/_lal_spin_evolution.py
lal_spin_evloution_wrapper
def lal_spin_evloution_wrapper(approximant, q, omega0, chiA0, chiB0, dt, spinO, phaseO): """ Inputs: approximant: 'SpinTaylorT1/T2/T4' q: Mass ratio (q>=1) omega0: Initial orbital frequency in dimless units. chiA0: Dimless spin of BhA at i...
python
def lal_spin_evloution_wrapper(approximant, q, omega0, chiA0, chiB0, dt, spinO, phaseO): """ Inputs: approximant: 'SpinTaylorT1/T2/T4' q: Mass ratio (q>=1) omega0: Initial orbital frequency in dimless units. chiA0: Dimless spin of BhA at i...
[ "def", "lal_spin_evloution_wrapper", "(", "approximant", ",", "q", ",", "omega0", ",", "chiA0", ",", "chiB0", ",", "dt", ",", "spinO", ",", "phaseO", ")", ":", "approxTag", "=", "lalsim", ".", "GetApproximantFromString", "(", "approximant", ")", "# Total mass ...
Inputs: approximant: 'SpinTaylorT1/T2/T4' q: Mass ratio (q>=1) omega0: Initial orbital frequency in dimless units. chiA0: Dimless spin of BhA at initial freq. chiB0: Dimless spin of BhB at initial freq. dt: Dimless ste...
[ "Inputs", ":", "approximant", ":", "SpinTaylorT1", "/", "T2", "/", "T4", "q", ":", "Mass", "ratio", "(", "q", ">", "=", "1", ")", "omega0", ":", "Initial", "orbital", "frequency", "in", "dimless", "units", ".", "chiA0", ":", "Dimless", "spin", "of", ...
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_lal_spin_evolution.py#L6-L155
vijayvarma392/surfinBH
surfinBH/_lal_spin_evolution.py
evolve_pn_spins
def evolve_pn_spins(q, chiA0, chiB0, omega0, omegaTimesM_final, approximant='SpinTaylorT4', dt=0.1, spinO=7, phaseO=7): """ Evolves PN spins from a starting orbital frequency and spins to a final frequency. Inputs: q: Mass ratio (q>=1) chiA0: Dimless sp...
python
def evolve_pn_spins(q, chiA0, chiB0, omega0, omegaTimesM_final, approximant='SpinTaylorT4', dt=0.1, spinO=7, phaseO=7): """ Evolves PN spins from a starting orbital frequency and spins to a final frequency. Inputs: q: Mass ratio (q>=1) chiA0: Dimless sp...
[ "def", "evolve_pn_spins", "(", "q", ",", "chiA0", ",", "chiB0", ",", "omega0", ",", "omegaTimesM_final", ",", "approximant", "=", "'SpinTaylorT4'", ",", "dt", "=", "0.1", ",", "spinO", "=", "7", ",", "phaseO", "=", "7", ")", ":", "omega", ",", "phi", ...
Evolves PN spins from a starting orbital frequency and spins to a final frequency. Inputs: q: Mass ratio (q>=1) chiA0: Dimless spin of BhA at initial freq. chiB0: Dimless spin of BhB at initial freq. omega0: Initial orbital freque...
[ "Evolves", "PN", "spins", "from", "a", "starting", "orbital", "frequency", "and", "spins", "to", "a", "final", "frequency", "." ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_lal_spin_evolution.py#L158-L211
crossbario/zlmdb
zlmdb/_pmap.py
is_null
def is_null(value): """ Check if the scalar value or tuple/list value is NULL. :param value: Value to check. :type value: a scalar or tuple or list :return: Returns ``True`` if and only if the value is NULL (scalar value is None or _any_ tuple/list elements are None). :rtype: bool ...
python
def is_null(value): """ Check if the scalar value or tuple/list value is NULL. :param value: Value to check. :type value: a scalar or tuple or list :return: Returns ``True`` if and only if the value is NULL (scalar value is None or _any_ tuple/list elements are None). :rtype: bool ...
[ "def", "is_null", "(", "value", ")", ":", "if", "type", "(", "value", ")", "in", "(", "tuple", ",", "list", ")", ":", "for", "v", "in", "value", ":", "if", "v", "is", "None", ":", "return", "True", "return", "False", "else", ":", "return", "value...
Check if the scalar value or tuple/list value is NULL. :param value: Value to check. :type value: a scalar or tuple or list :return: Returns ``True`` if and only if the value is NULL (scalar value is None or _any_ tuple/list elements are None). :rtype: bool
[ "Check", "if", "the", "scalar", "value", "or", "tuple", "/", "list", "value", "is", "NULL", "." ]
train
https://github.com/crossbario/zlmdb/blob/577e8ce9314484f1fd5092fb4eef70221bb1d030/zlmdb/_pmap.py#L245-L262
crossbario/zlmdb
zlmdb/_pmap.py
qual
def qual(obj): """ Return fully qualified name of a class. """ return u'{}.{}'.format(obj.__class__.__module__, obj.__class__.__name__)
python
def qual(obj): """ Return fully qualified name of a class. """ return u'{}.{}'.format(obj.__class__.__module__, obj.__class__.__name__)
[ "def", "qual", "(", "obj", ")", ":", "return", "u'{}.{}'", ".", "format", "(", "obj", ".", "__class__", ".", "__module__", ",", "obj", ".", "__class__", ".", "__name__", ")" ]
Return fully qualified name of a class.
[ "Return", "fully", "qualified", "name", "of", "a", "class", "." ]
train
https://github.com/crossbario/zlmdb/blob/577e8ce9314484f1fd5092fb4eef70221bb1d030/zlmdb/_pmap.py#L265-L269
crossbario/zlmdb
zlmdb/_pmap.py
PersistentMap.select
def select(self, txn, from_key=None, to_key=None, return_keys=True, return_values=True, reverse=False, limit=None): """ Select all records (key-value pairs) in table, optionally within a given key range. :param txn: The transaction in which to run. :type txn: :class:`zlmdb.Transaction` ...
python
def select(self, txn, from_key=None, to_key=None, return_keys=True, return_values=True, reverse=False, limit=None): """ Select all records (key-value pairs) in table, optionally within a given key range. :param txn: The transaction in which to run. :type txn: :class:`zlmdb.Transaction` ...
[ "def", "select", "(", "self", ",", "txn", ",", "from_key", "=", "None", ",", "to_key", "=", "None", ",", "return_keys", "=", "True", ",", "return_values", "=", "True", ",", "reverse", "=", "False", ",", "limit", "=", "None", ")", ":", "assert", "type...
Select all records (key-value pairs) in table, optionally within a given key range. :param txn: The transaction in which to run. :type txn: :class:`zlmdb.Transaction` :param from_key: Return records starting from (and including) this key. :type from_key: object :param to_key: ...
[ "Select", "all", "records", "(", "key", "-", "value", "pairs", ")", "in", "table", "optionally", "within", "a", "given", "key", "range", "." ]
train
https://github.com/crossbario/zlmdb/blob/577e8ce9314484f1fd5092fb4eef70221bb1d030/zlmdb/_pmap.py#L475-L511
crossbario/zlmdb
zlmdb/_pmap.py
PersistentMap.count
def count(self, txn, prefix=None): """ Count number of records in the persistent map. When no prefix is given, the total number of records is returned. When a prefix is given, only the number of records with keys that have this prefix are counted. :param txn: The transac...
python
def count(self, txn, prefix=None): """ Count number of records in the persistent map. When no prefix is given, the total number of records is returned. When a prefix is given, only the number of records with keys that have this prefix are counted. :param txn: The transac...
[ "def", "count", "(", "self", ",", "txn", ",", "prefix", "=", "None", ")", ":", "key_from", "=", "struct", ".", "pack", "(", "'>H'", ",", "self", ".", "_slot", ")", "if", "prefix", ":", "key_from", "+=", "self", ".", "_serialize_key", "(", "prefix", ...
Count number of records in the persistent map. When no prefix is given, the total number of records is returned. When a prefix is given, only the number of records with keys that have this prefix are counted. :param txn: The transaction in which to run. :type txn: :class:`zlmdb....
[ "Count", "number", "of", "records", "in", "the", "persistent", "map", ".", "When", "no", "prefix", "is", "given", "the", "total", "number", "of", "records", "is", "returned", ".", "When", "a", "prefix", "is", "given", "only", "the", "number", "of", "reco...
train
https://github.com/crossbario/zlmdb/blob/577e8ce9314484f1fd5092fb4eef70221bb1d030/zlmdb/_pmap.py#L513-L545
crossbario/zlmdb
zlmdb/_pmap.py
PersistentMap.count_range
def count_range(self, txn, from_key, to_key): """ Counter number of records in the perstistent map with keys within the given range. :param txn: The transaction in which to run. :type txn: :class:`zlmdb.Transaction` :param from_key: Count records starting and including ...
python
def count_range(self, txn, from_key, to_key): """ Counter number of records in the perstistent map with keys within the given range. :param txn: The transaction in which to run. :type txn: :class:`zlmdb.Transaction` :param from_key: Count records starting and including ...
[ "def", "count_range", "(", "self", ",", "txn", ",", "from_key", ",", "to_key", ")", ":", "key_from", "=", "struct", ".", "pack", "(", "'>H'", ",", "self", ".", "_slot", ")", "+", "self", ".", "_serialize_key", "(", "from_key", ")", "to_key", "=", "st...
Counter number of records in the perstistent map with keys within the given range. :param txn: The transaction in which to run. :type txn: :class:`zlmdb.Transaction` :param from_key: Count records starting and including from this key. :type from_key: object :param to_k...
[ "Counter", "number", "of", "records", "in", "the", "perstistent", "map", "with", "keys", "within", "the", "given", "range", "." ]
train
https://github.com/crossbario/zlmdb/blob/577e8ce9314484f1fd5092fb4eef70221bb1d030/zlmdb/_pmap.py#L547-L576
crossbario/zlmdb
zlmdb/_types.py
_random_string
def _random_string(): """ Generate a globally unique serial / product code of the form ``u'YRAC-EL4X-FQQE-AW4T-WNUV-VN6T'``. The generated value is cryptographically strong and has (at least) 114 bits of entropy. :return: new random string key """ rng = random.SystemRandom() token_value = u...
python
def _random_string(): """ Generate a globally unique serial / product code of the form ``u'YRAC-EL4X-FQQE-AW4T-WNUV-VN6T'``. The generated value is cryptographically strong and has (at least) 114 bits of entropy. :return: new random string key """ rng = random.SystemRandom() token_value = u...
[ "def", "_random_string", "(", ")", ":", "rng", "=", "random", ".", "SystemRandom", "(", ")", "token_value", "=", "u''", ".", "join", "(", "rng", ".", "choice", "(", "CHARSET", ")", "for", "_", "in", "range", "(", "CHAR_GROUPS", "*", "CHARS_PER_GROUP", ...
Generate a globally unique serial / product code of the form ``u'YRAC-EL4X-FQQE-AW4T-WNUV-VN6T'``. The generated value is cryptographically strong and has (at least) 114 bits of entropy. :return: new random string key
[ "Generate", "a", "globally", "unique", "serial", "/", "product", "code", "of", "the", "form", "u", "YRAC", "-", "EL4X", "-", "FQQE", "-", "AW4T", "-", "WNUV", "-", "VN6T", ".", "The", "generated", "value", "is", "cryptographically", "strong", "and", "has...
train
https://github.com/crossbario/zlmdb/blob/577e8ce9314484f1fd5092fb4eef70221bb1d030/zlmdb/_types.py#L78-L90
vijayvarma392/surfinBH
surfinBH/surfinBH.py
SurFinBH._read_dict
def _read_dict(self, f): """ Converts h5 groups to dictionaries """ d = {} for k, item in f.items(): if type(item) == h5py._hl.dataset.Dataset: v = item.value if type(v) == np.string_: v = str(v) if type(v) =...
python
def _read_dict(self, f): """ Converts h5 groups to dictionaries """ d = {} for k, item in f.items(): if type(item) == h5py._hl.dataset.Dataset: v = item.value if type(v) == np.string_: v = str(v) if type(v) =...
[ "def", "_read_dict", "(", "self", ",", "f", ")", ":", "d", "=", "{", "}", "for", "k", ",", "item", "in", "f", ".", "items", "(", ")", ":", "if", "type", "(", "item", ")", "==", "h5py", ".", "_hl", ".", "dataset", ".", "Dataset", ":", "v", "...
Converts h5 groups to dictionaries
[ "Converts", "h5", "groups", "to", "dictionaries" ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/surfinBH.py#L77-L100
vijayvarma392/surfinBH
surfinBH/surfinBH.py
SurFinBH._load_scalar_fit
def _load_scalar_fit(self, fit_key=None, h5file=None, fit_data=None): """ Loads a single fit """ if (fit_key is None) ^ (h5file is None): raise ValueError("Either specify both fit_key and h5file, or" " neither") if not ((fit_key is None) ^ (fit_data is None))...
python
def _load_scalar_fit(self, fit_key=None, h5file=None, fit_data=None): """ Loads a single fit """ if (fit_key is None) ^ (h5file is None): raise ValueError("Either specify both fit_key and h5file, or" " neither") if not ((fit_key is None) ^ (fit_data is None))...
[ "def", "_load_scalar_fit", "(", "self", ",", "fit_key", "=", "None", ",", "h5file", "=", "None", ",", "fit_data", "=", "None", ")", ":", "if", "(", "fit_key", "is", "None", ")", "^", "(", "h5file", "is", "None", ")", ":", "raise", "ValueError", "(", ...
Loads a single fit
[ "Loads", "a", "single", "fit" ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/surfinBH.py#L103-L121
vijayvarma392/surfinBH
surfinBH/surfinBH.py
SurFinBH._load_vector_fit
def _load_vector_fit(self, fit_key, h5file): """ Loads a vector of fits """ vector_fit = [] for i in range(len(h5file[fit_key].keys())): fit_data = self._read_dict(h5file[fit_key]['comp_%d'%i]) vector_fit.append(self._load_scalar_fit(fit_data=fit_data)) re...
python
def _load_vector_fit(self, fit_key, h5file): """ Loads a vector of fits """ vector_fit = [] for i in range(len(h5file[fit_key].keys())): fit_data = self._read_dict(h5file[fit_key]['comp_%d'%i]) vector_fit.append(self._load_scalar_fit(fit_data=fit_data)) re...
[ "def", "_load_vector_fit", "(", "self", ",", "fit_key", ",", "h5file", ")", ":", "vector_fit", "=", "[", "]", "for", "i", "in", "range", "(", "len", "(", "h5file", "[", "fit_key", "]", ".", "keys", "(", ")", ")", ")", ":", "fit_data", "=", "self", ...
Loads a vector of fits
[ "Loads", "a", "vector", "of", "fits" ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/surfinBH.py#L124-L131
vijayvarma392/surfinBH
surfinBH/surfinBH.py
SurFinBH._evaluate_fits
def _evaluate_fits(self, x, fit_key): """ Evaluates a particular fit by passing fit_key to self.fits. Assumes self._get_fit_params() has been overriden. """ fit = self.fits[fit_key] fit_params = self._get_fit_params(np.copy(x), fit_key) if type(fit) == list: ...
python
def _evaluate_fits(self, x, fit_key): """ Evaluates a particular fit by passing fit_key to self.fits. Assumes self._get_fit_params() has been overriden. """ fit = self.fits[fit_key] fit_params = self._get_fit_params(np.copy(x), fit_key) if type(fit) == list: ...
[ "def", "_evaluate_fits", "(", "self", ",", "x", ",", "fit_key", ")", ":", "fit", "=", "self", ".", "fits", "[", "fit_key", "]", "fit_params", "=", "self", ".", "_get_fit_params", "(", "np", ".", "copy", "(", "x", ")", ",", "fit_key", ")", "if", "ty...
Evaluates a particular fit by passing fit_key to self.fits. Assumes self._get_fit_params() has been overriden.
[ "Evaluates", "a", "particular", "fit", "by", "passing", "fit_key", "to", "self", ".", "fits", ".", "Assumes", "self", ".", "_get_fit_params", "()", "has", "been", "overriden", "." ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/surfinBH.py#L134-L146
vijayvarma392/surfinBH
surfinBH/surfinBH.py
SurFinBH._check_unused_kwargs
def _check_unused_kwargs(self, kwargs): """ Call this at the end of call module to check if all the kwargs have been used. Assumes kwargs were extracted using pop. """ if len(kwargs.keys()) != 0: unused = "" for k in kwargs.keys(): unused += "'%s',...
python
def _check_unused_kwargs(self, kwargs): """ Call this at the end of call module to check if all the kwargs have been used. Assumes kwargs were extracted using pop. """ if len(kwargs.keys()) != 0: unused = "" for k in kwargs.keys(): unused += "'%s',...
[ "def", "_check_unused_kwargs", "(", "self", ",", "kwargs", ")", ":", "if", "len", "(", "kwargs", ".", "keys", "(", ")", ")", "!=", "0", ":", "unused", "=", "\"\"", "for", "k", "in", "kwargs", ".", "keys", "(", ")", ":", "unused", "+=", "\"'%s', \""...
Call this at the end of call module to check if all the kwargs have been used. Assumes kwargs were extracted using pop.
[ "Call", "this", "at", "the", "end", "of", "call", "module", "to", "check", "if", "all", "the", "kwargs", "have", "been", "used", ".", "Assumes", "kwargs", "were", "extracted", "using", "pop", "." ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/surfinBH.py#L149-L159
vijayvarma392/surfinBH
surfinBH/surfinBH.py
SurFinBH._check_param_limits
def _check_param_limits(self, q, chiA, chiB, allow_extrap): """ Checks that params are within allowed range of paramters. Raises a warning if outside self.soft_param_lims limits and raises an error if outside self.hard_param_lims. If allow_extrap=True, skips these checks. """ ...
python
def _check_param_limits(self, q, chiA, chiB, allow_extrap): """ Checks that params are within allowed range of paramters. Raises a warning if outside self.soft_param_lims limits and raises an error if outside self.hard_param_lims. If allow_extrap=True, skips these checks. """ ...
[ "def", "_check_param_limits", "(", "self", ",", "q", ",", "chiA", ",", "chiB", ",", "allow_extrap", ")", ":", "if", "q", "<", "1", ":", "raise", "ValueError", "(", "'Mass ratio should be >= 1.'", ")", "chiAmag", "=", "np", ".", "sqrt", "(", "np", ".", ...
Checks that params are within allowed range of paramters. Raises a warning if outside self.soft_param_lims limits and raises an error if outside self.hard_param_lims. If allow_extrap=True, skips these checks.
[ "Checks", "that", "params", "are", "within", "allowed", "range", "of", "paramters", ".", "Raises", "a", "warning", "if", "outside", "self", ".", "soft_param_lims", "limits", "and", "raises", "an", "error", "if", "outside", "self", ".", "hard_param_lims", ".", ...
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/surfinBH.py#L162-L202
crossbario/zlmdb
zlmdb/_schema.py
Schema.slot
def slot(self, slot_index, marshal=None, unmarshal=None, build=None, cast=None, compress=False): """ Decorator for use on classes derived from zlmdb.PersistentMap. The decorator define slots in a LMDB database schema based on persistent maps, and slot configuration. :param slot_index: ...
python
def slot(self, slot_index, marshal=None, unmarshal=None, build=None, cast=None, compress=False): """ Decorator for use on classes derived from zlmdb.PersistentMap. The decorator define slots in a LMDB database schema based on persistent maps, and slot configuration. :param slot_index: ...
[ "def", "slot", "(", "self", ",", "slot_index", ",", "marshal", "=", "None", ",", "unmarshal", "=", "None", ",", "build", "=", "None", ",", "cast", "=", "None", ",", "compress", "=", "False", ")", ":", "def", "decorate", "(", "o", ")", ":", "assert"...
Decorator for use on classes derived from zlmdb.PersistentMap. The decorator define slots in a LMDB database schema based on persistent maps, and slot configuration. :param slot_index: :param marshal: :param unmarshal: :param build: :param cast: :param compress: ...
[ "Decorator", "for", "use", "on", "classes", "derived", "from", "zlmdb", ".", "PersistentMap", ".", "The", "decorator", "define", "slots", "in", "a", "LMDB", "database", "schema", "based", "on", "persistent", "maps", "and", "slot", "configuration", "." ]
train
https://github.com/crossbario/zlmdb/blob/577e8ce9314484f1fd5092fb4eef70221bb1d030/zlmdb/_schema.py#L101-L131
vijayvarma392/surfinBH
surfinBH/_dataPath.py
DataPath
def DataPath(): """ Return the default path for fit data h5 files""" return os.path.abspath('%s/data'%(os.path.dirname( \ os.path.realpath(__file__))))
python
def DataPath(): """ Return the default path for fit data h5 files""" return os.path.abspath('%s/data'%(os.path.dirname( \ os.path.realpath(__file__))))
[ "def", "DataPath", "(", ")", ":", "return", "os", ".", "path", ".", "abspath", "(", "'%s/data'", "%", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", ")", ")" ]
Return the default path for fit data h5 files
[ "Return", "the", "default", "path", "for", "fit", "data", "h5", "files" ]
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_dataPath.py#L4-L7
openid/JWTConnect-Python-OidcService
src/oidcservice/oidc/utils.py
request_object_encryption
def request_object_encryption(msg, service_context, **kwargs): """ Created an encrypted JSON Web token with *msg* as body. :param msg: The mesaqg :param service_context: :param kwargs: :return: """ try: encalg = kwargs["request_object_encryption_alg"] except KeyError: ...
python
def request_object_encryption(msg, service_context, **kwargs): """ Created an encrypted JSON Web token with *msg* as body. :param msg: The mesaqg :param service_context: :param kwargs: :return: """ try: encalg = kwargs["request_object_encryption_alg"] except KeyError: ...
[ "def", "request_object_encryption", "(", "msg", ",", "service_context", ",", "*", "*", "kwargs", ")", ":", "try", ":", "encalg", "=", "kwargs", "[", "\"request_object_encryption_alg\"", "]", "except", "KeyError", ":", "try", ":", "encalg", "=", "service_context"...
Created an encrypted JSON Web token with *msg* as body. :param msg: The mesaqg :param service_context: :param kwargs: :return:
[ "Created", "an", "encrypted", "JSON", "Web", "token", "with", "*", "msg", "*", "as", "body", "." ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/oidc/utils.py#L10-L63
openid/JWTConnect-Python-OidcService
src/oidcservice/oidc/utils.py
construct_request_uri
def construct_request_uri(local_dir, base_path, **kwargs): """ Constructs a special redirect_uri to be used when communicating with one OP. Each OP should get their own redirect_uris. :param local_dir: Local directory in which to place the file :param base_path: Base URL to start with :para...
python
def construct_request_uri(local_dir, base_path, **kwargs): """ Constructs a special redirect_uri to be used when communicating with one OP. Each OP should get their own redirect_uris. :param local_dir: Local directory in which to place the file :param base_path: Base URL to start with :para...
[ "def", "construct_request_uri", "(", "local_dir", ",", "base_path", ",", "*", "*", "kwargs", ")", ":", "_filedir", "=", "local_dir", "if", "not", "os", ".", "path", ".", "isdir", "(", "_filedir", ")", ":", "os", ".", "makedirs", "(", "_filedir", ")", "...
Constructs a special redirect_uri to be used when communicating with one OP. Each OP should get their own redirect_uris. :param local_dir: Local directory in which to place the file :param base_path: Base URL to start with :param kwargs: :return: 2-tuple with (filename, url)
[ "Constructs", "a", "special", "redirect_uri", "to", "be", "used", "when", "communicating", "with", "one", "OP", ".", "Each", "OP", "should", "get", "their", "own", "redirect_uris", ".", ":", "param", "local_dir", ":", "Local", "directory", "in", "which", "to...
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/oidc/utils.py#L66-L86
openid/JWTConnect-Python-OidcService
src/oidcservice/service.py
init_services
def init_services(service_definitions, service_context, state_db, client_authn_factory=None): """ Initiates a set of services :param service_definitions: A dictionary cotaining service definitions :param service_context: A reference to the service context, this is the same for...
python
def init_services(service_definitions, service_context, state_db, client_authn_factory=None): """ Initiates a set of services :param service_definitions: A dictionary cotaining service definitions :param service_context: A reference to the service context, this is the same for...
[ "def", "init_services", "(", "service_definitions", ",", "service_context", ",", "state_db", ",", "client_authn_factory", "=", "None", ")", ":", "service", "=", "{", "}", "for", "service_name", ",", "service_configuration", "in", "service_definitions", ".", "items",...
Initiates a set of services :param service_definitions: A dictionary cotaining service definitions :param service_context: A reference to the service context, this is the same for all service instances. :param state_db: A reference to the state database. Shared by all the services. :par...
[ "Initiates", "a", "set", "of", "services" ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service.py#L514-L550
openid/JWTConnect-Python-OidcService
src/oidcservice/service.py
Service.gather_request_args
def gather_request_args(self, **kwargs): """ Go through the attributes that the message class can contain and add values if they are missing but exists in the client info or when there are default values. :param kwargs: Initial set of attributes. :return: Possibly augmen...
python
def gather_request_args(self, **kwargs): """ Go through the attributes that the message class can contain and add values if they are missing but exists in the client info or when there are default values. :param kwargs: Initial set of attributes. :return: Possibly augmen...
[ "def", "gather_request_args", "(", "self", ",", "*", "*", "kwargs", ")", ":", "ar_args", "=", "kwargs", ".", "copy", "(", ")", "# Go through the list of claims defined for the message class", "# there are a couple of places where informtation can be found", "# access them in th...
Go through the attributes that the message class can contain and add values if they are missing but exists in the client info or when there are default values. :param kwargs: Initial set of attributes. :return: Possibly augmented set of attributes
[ "Go", "through", "the", "attributes", "that", "the", "message", "class", "can", "contain", "and", "add", "values", "if", "they", "are", "missing", "but", "exists", "in", "the", "client", "info", "or", "when", "there", "are", "default", "values", "." ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service.py#L68-L104
openid/JWTConnect-Python-OidcService
src/oidcservice/service.py
Service.method_args
def method_args(self, context, **kwargs): """ Collect the set of arguments that should be used by a set of methods :param context: Which service we're working for :param kwargs: A set of keyword arguments that are added at run-time. :return: A set of keyword arguments ""...
python
def method_args(self, context, **kwargs): """ Collect the set of arguments that should be used by a set of methods :param context: Which service we're working for :param kwargs: A set of keyword arguments that are added at run-time. :return: A set of keyword arguments ""...
[ "def", "method_args", "(", "self", ",", "context", ",", "*", "*", "kwargs", ")", ":", "try", ":", "_args", "=", "self", ".", "conf", "[", "context", "]", ".", "copy", "(", ")", "except", "KeyError", ":", "_args", "=", "kwargs", "else", ":", "_args"...
Collect the set of arguments that should be used by a set of methods :param context: Which service we're working for :param kwargs: A set of keyword arguments that are added at run-time. :return: A set of keyword arguments
[ "Collect", "the", "set", "of", "arguments", "that", "should", "be", "used", "by", "a", "set", "of", "methods" ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service.py#L106-L120
openid/JWTConnect-Python-OidcService
src/oidcservice/service.py
Service.do_pre_construct
def do_pre_construct(self, request_args, **kwargs): """ Will run the pre_construct methods one by one in the order given. :param request_args: Request arguments :param kwargs: Extra key word arguments :return: A tuple of request_args and post_args. post_args are to be ...
python
def do_pre_construct(self, request_args, **kwargs): """ Will run the pre_construct methods one by one in the order given. :param request_args: Request arguments :param kwargs: Extra key word arguments :return: A tuple of request_args and post_args. post_args are to be ...
[ "def", "do_pre_construct", "(", "self", ",", "request_args", ",", "*", "*", "kwargs", ")", ":", "_args", "=", "self", ".", "method_args", "(", "'pre_construct'", ",", "*", "*", "kwargs", ")", "post_args", "=", "{", "}", "for", "meth", "in", "self", "."...
Will run the pre_construct methods one by one in the order given. :param request_args: Request arguments :param kwargs: Extra key word arguments :return: A tuple of request_args and post_args. post_args are to be used by the post_construct methods.
[ "Will", "run", "the", "pre_construct", "methods", "one", "by", "one", "in", "the", "order", "given", "." ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service.py#L122-L138
openid/JWTConnect-Python-OidcService
src/oidcservice/service.py
Service.do_post_construct
def do_post_construct(self, request_args, **kwargs): """ Will run the post_construct methods one at the time in order. :param request_args: Request arguments :param kwargs: Arguments used by the post_construct method :return: Possible modified set of request arguments. "...
python
def do_post_construct(self, request_args, **kwargs): """ Will run the post_construct methods one at the time in order. :param request_args: Request arguments :param kwargs: Arguments used by the post_construct method :return: Possible modified set of request arguments. "...
[ "def", "do_post_construct", "(", "self", ",", "request_args", ",", "*", "*", "kwargs", ")", ":", "_args", "=", "self", ".", "method_args", "(", "'post_construct'", ",", "*", "*", "kwargs", ")", "for", "meth", "in", "self", ".", "post_construct", ":", "re...
Will run the post_construct methods one at the time in order. :param request_args: Request arguments :param kwargs: Arguments used by the post_construct method :return: Possible modified set of request arguments.
[ "Will", "run", "the", "post_construct", "methods", "one", "at", "the", "time", "in", "order", "." ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service.py#L140-L153
openid/JWTConnect-Python-OidcService
src/oidcservice/service.py
Service.construct
def construct(self, request_args=None, **kwargs): """ Instantiate the request as a message class instance with attribute values gathered in a pre_construct method or in the gather_request_args method. :param request_args: :param kwargs: extra keyword arguments :r...
python
def construct(self, request_args=None, **kwargs): """ Instantiate the request as a message class instance with attribute values gathered in a pre_construct method or in the gather_request_args method. :param request_args: :param kwargs: extra keyword arguments :r...
[ "def", "construct", "(", "self", ",", "request_args", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "request_args", "is", "None", ":", "request_args", "=", "{", "}", "# run the pre_construct methods. Will return a possibly new", "# set of request arguments but...
Instantiate the request as a message class instance with attribute values gathered in a pre_construct method or in the gather_request_args method. :param request_args: :param kwargs: extra keyword arguments :return: message class instance
[ "Instantiate", "the", "request", "as", "a", "message", "class", "instance", "with", "attribute", "values", "gathered", "in", "a", "pre_construct", "method", "or", "in", "the", "gather_request_args", "method", "." ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service.py#L165-L199
openid/JWTConnect-Python-OidcService
src/oidcservice/service.py
Service.init_authentication_method
def init_authentication_method(self, request, authn_method, http_args=None, **kwargs): """ Will run the proper client authentication method. Each such method will place the necessary information in the necessary place. A method may modify the request. ...
python
def init_authentication_method(self, request, authn_method, http_args=None, **kwargs): """ Will run the proper client authentication method. Each such method will place the necessary information in the necessary place. A method may modify the request. ...
[ "def", "init_authentication_method", "(", "self", ",", "request", ",", "authn_method", ",", "http_args", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "http_args", "is", "None", ":", "http_args", "=", "{", "}", "if", "authn_method", ":", "logger", ...
Will run the proper client authentication method. Each such method will place the necessary information in the necessary place. A method may modify the request. :param request: The request, a Message class instance :param authn_method: Client authentication method :param http_ar...
[ "Will", "run", "the", "proper", "client", "authentication", "method", ".", "Each", "such", "method", "will", "place", "the", "necessary", "information", "in", "the", "necessary", "place", ".", "A", "method", "may", "modify", "the", "request", "." ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service.py#L201-L222
openid/JWTConnect-Python-OidcService
src/oidcservice/service.py
Service.construct_request
def construct_request(self, request_args=None, **kwargs): """ The method where everything is setup for sending the request. The request information is gathered and the where and how of sending the request is decided. :param request_args: Initial request arguments :param ...
python
def construct_request(self, request_args=None, **kwargs): """ The method where everything is setup for sending the request. The request information is gathered and the where and how of sending the request is decided. :param request_args: Initial request arguments :param ...
[ "def", "construct_request", "(", "self", ",", "request_args", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "request_args", "is", "None", ":", "request_args", "=", "{", "}", "# remove arguments that should not be included in the request", "# _args = dict(", ...
The method where everything is setup for sending the request. The request information is gathered and the where and how of sending the request is decided. :param request_args: Initial request arguments :param kwargs: Extra keyword arguments :return: A dictionary with the keys 'u...
[ "The", "method", "where", "everything", "is", "setup", "for", "sending", "the", "request", ".", "The", "request", "information", "is", "gathered", "and", "the", "where", "and", "how", "of", "sending", "the", "request", "is", "decided", "." ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service.py#L224-L242
openid/JWTConnect-Python-OidcService
src/oidcservice/service.py
Service.get_endpoint
def get_endpoint(self): """ Find the service endpoint :return: The service endpoint (a URL) """ if self.endpoint: return self.endpoint else: return self.service_context.provider_info[self.endpoint_name]
python
def get_endpoint(self): """ Find the service endpoint :return: The service endpoint (a URL) """ if self.endpoint: return self.endpoint else: return self.service_context.provider_info[self.endpoint_name]
[ "def", "get_endpoint", "(", "self", ")", ":", "if", "self", ".", "endpoint", ":", "return", "self", ".", "endpoint", "else", ":", "return", "self", ".", "service_context", ".", "provider_info", "[", "self", ".", "endpoint_name", "]" ]
Find the service endpoint :return: The service endpoint (a URL)
[ "Find", "the", "service", "endpoint" ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service.py#L244-L253
openid/JWTConnect-Python-OidcService
src/oidcservice/service.py
Service.get_authn_header
def get_authn_header(self, request, authn_method, **kwargs): """ Construct an authorization specification to be sent in the HTTP header. :param request: The service request :param authn_method: Which authentication/authorization method to use :param kwargs: Extra keyword...
python
def get_authn_header(self, request, authn_method, **kwargs): """ Construct an authorization specification to be sent in the HTTP header. :param request: The service request :param authn_method: Which authentication/authorization method to use :param kwargs: Extra keyword...
[ "def", "get_authn_header", "(", "self", ",", "request", ",", "authn_method", ",", "*", "*", "kwargs", ")", ":", "headers", "=", "{", "}", "# If I should deal with client authentication", "if", "authn_method", ":", "h_arg", "=", "self", ".", "init_authentication_me...
Construct an authorization specification to be sent in the HTTP header. :param request: The service request :param authn_method: Which authentication/authorization method to use :param kwargs: Extra keyword arguments :return: A set of keyword arguments to be sent in the HTTP hea...
[ "Construct", "an", "authorization", "specification", "to", "be", "sent", "in", "the", "HTTP", "header", "." ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service.py#L255-L275
openid/JWTConnect-Python-OidcService
src/oidcservice/service.py
Service.get_request_parameters
def get_request_parameters(self, request_body_type="", method="", authn_method='', request_args=None, http_args=None, **kwargs): """ Builds the request message and constructs the HTTP headers. This is the starting point for a pipelin...
python
def get_request_parameters(self, request_body_type="", method="", authn_method='', request_args=None, http_args=None, **kwargs): """ Builds the request message and constructs the HTTP headers. This is the starting point for a pipelin...
[ "def", "get_request_parameters", "(", "self", ",", "request_body_type", "=", "\"\"", ",", "method", "=", "\"\"", ",", "authn_method", "=", "''", ",", "request_args", "=", "None", ",", "http_args", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "no...
Builds the request message and constructs the HTTP headers. This is the starting point for a pipeline that will: - construct the request message - add/remove information to/from the request message in the way a specific client authentication method requires. - gather a set ...
[ "Builds", "the", "request", "message", "and", "constructs", "the", "HTTP", "headers", "." ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service.py#L286-L355
openid/JWTConnect-Python-OidcService
src/oidcservice/service.py
Service.get_urlinfo
def get_urlinfo(info): """ Pick out the fragment or query part from a URL. :param info: A URL possibly containing a query or a fragment part :return: the query/fragment part """ # If info is a whole URL pick out the query or fragment part if '?' in info or '#' in...
python
def get_urlinfo(info): """ Pick out the fragment or query part from a URL. :param info: A URL possibly containing a query or a fragment part :return: the query/fragment part """ # If info is a whole URL pick out the query or fragment part if '?' in info or '#' in...
[ "def", "get_urlinfo", "(", "info", ")", ":", "# If info is a whole URL pick out the query or fragment part", "if", "'?'", "in", "info", "or", "'#'", "in", "info", ":", "parts", "=", "urlparse", "(", "info", ")", "scheme", ",", "netloc", ",", "path", ",", "para...
Pick out the fragment or query part from a URL. :param info: A URL possibly containing a query or a fragment part :return: the query/fragment part
[ "Pick", "out", "the", "fragment", "or", "query", "part", "from", "a", "URL", "." ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service.py#L360-L376
openid/JWTConnect-Python-OidcService
src/oidcservice/service.py
Service.gather_verify_arguments
def gather_verify_arguments(self): """ Need to add some information before running verify() :return: dictionary with arguments to the verify call """ kwargs = {'client_id': self.service_context.client_id, 'iss': self.service_context.issuer, '...
python
def gather_verify_arguments(self): """ Need to add some information before running verify() :return: dictionary with arguments to the verify call """ kwargs = {'client_id': self.service_context.client_id, 'iss': self.service_context.issuer, '...
[ "def", "gather_verify_arguments", "(", "self", ")", ":", "kwargs", "=", "{", "'client_id'", ":", "self", ".", "service_context", ".", "client_id", ",", "'iss'", ":", "self", ".", "service_context", ".", "issuer", ",", "'keyjar'", ":", "self", ".", "service_c...
Need to add some information before running verify() :return: dictionary with arguments to the verify call
[ "Need", "to", "add", "some", "information", "before", "running", "verify", "()" ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service.py#L389-L400
openid/JWTConnect-Python-OidcService
src/oidcservice/service.py
Service.parse_response
def parse_response(self, info, sformat="", state="", **kwargs): """ This the start of a pipeline that will: 1 Deserializes a response into it's response message class. Or :py:class:`oidcmsg.oauth2.ErrorResponse` if it's an error message 2 verifies the...
python
def parse_response(self, info, sformat="", state="", **kwargs): """ This the start of a pipeline that will: 1 Deserializes a response into it's response message class. Or :py:class:`oidcmsg.oauth2.ErrorResponse` if it's an error message 2 verifies the...
[ "def", "parse_response", "(", "self", ",", "info", ",", "sformat", "=", "\"\"", ",", "state", "=", "\"\"", ",", "*", "*", "kwargs", ")", ":", "if", "not", "sformat", ":", "sformat", "=", "self", ".", "response_body_type", "logger", ".", "debug", "(", ...
This the start of a pipeline that will: 1 Deserializes a response into it's response message class. Or :py:class:`oidcmsg.oauth2.ErrorResponse` if it's an error message 2 verifies the correctness of the response by running the verify method belonging to...
[ "This", "the", "start", "of", "a", "pipeline", "that", "will", ":" ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service.py#L402-L496
openid/JWTConnect-Python-OidcService
src/oidcservice/service.py
Service.get_conf_attr
def get_conf_attr(self, attr, default=None): """ Get the value of a attribute in the configuration :param attr: The attribute :param default: If the attribute doesn't appear in the configuration return this value :return: The value of attribute in the configuration o...
python
def get_conf_attr(self, attr, default=None): """ Get the value of a attribute in the configuration :param attr: The attribute :param default: If the attribute doesn't appear in the configuration return this value :return: The value of attribute in the configuration o...
[ "def", "get_conf_attr", "(", "self", ",", "attr", ",", "default", "=", "None", ")", ":", "if", "attr", "in", "self", ".", "conf", ":", "return", "self", ".", "conf", "[", "attr", "]", "else", ":", "return", "default" ]
Get the value of a attribute in the configuration :param attr: The attribute :param default: If the attribute doesn't appear in the configuration return this value :return: The value of attribute in the configuration or the default value
[ "Get", "the", "value", "of", "a", "attribute", "in", "the", "configuration" ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service.py#L498-L511
openid/JWTConnect-Python-OidcService
src/oidcservice/oidc/pkce.py
add_code_challenge
def add_code_challenge(request_args, service, **kwargs): """ PKCE RFC 7636 support To be added as a post_construct method to an :py:class:`oidcservice.oidc.service.Authorization` instance :param service: The service that uses this function :param request_args: Set of request arguments :para...
python
def add_code_challenge(request_args, service, **kwargs): """ PKCE RFC 7636 support To be added as a post_construct method to an :py:class:`oidcservice.oidc.service.Authorization` instance :param service: The service that uses this function :param request_args: Set of request arguments :para...
[ "def", "add_code_challenge", "(", "request_args", ",", "service", ",", "*", "*", "kwargs", ")", ":", "try", ":", "cv_len", "=", "service", ".", "service_context", ".", "config", "[", "'code_challenge'", "]", "[", "'length'", "]", "except", "KeyError", ":", ...
PKCE RFC 7636 support To be added as a post_construct method to an :py:class:`oidcservice.oidc.service.Authorization` instance :param service: The service that uses this function :param request_args: Set of request arguments :param kwargs: Extra set of keyword arguments :return: Updated set of ...
[ "PKCE", "RFC", "7636", "support", "To", "be", "added", "as", "a", "post_construct", "method", "to", "an", ":", "py", ":", "class", ":", "oidcservice", ".", "oidc", ".", "service", ".", "Authorization", "instance" ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/oidc/pkce.py#L9-L50
openid/JWTConnect-Python-OidcService
src/oidcservice/oidc/pkce.py
add_code_verifier
def add_code_verifier(request_args, service, **kwargs): """ PKCE RFC 7636 support To be added as a post_construct method to an :py:class:`oidcservice.oidc.service.AccessToken` instance :param service: The service that uses this function :param request_args: Set of request arguments :return:...
python
def add_code_verifier(request_args, service, **kwargs): """ PKCE RFC 7636 support To be added as a post_construct method to an :py:class:`oidcservice.oidc.service.AccessToken` instance :param service: The service that uses this function :param request_args: Set of request arguments :return:...
[ "def", "add_code_verifier", "(", "request_args", ",", "service", ",", "*", "*", "kwargs", ")", ":", "_item", "=", "service", ".", "get_item", "(", "Message", ",", "'pkce'", ",", "kwargs", "[", "'state'", "]", ")", "request_args", ".", "update", "(", "{",...
PKCE RFC 7636 support To be added as a post_construct method to an :py:class:`oidcservice.oidc.service.AccessToken` instance :param service: The service that uses this function :param request_args: Set of request arguments :return: updated set of request arguments
[ "PKCE", "RFC", "7636", "support", "To", "be", "added", "as", "a", "post_construct", "method", "to", "an", ":", "py", ":", "class", ":", "oidcservice", ".", "oidc", ".", "service", ".", "AccessToken", "instance" ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/oidc/pkce.py#L53-L65
openid/JWTConnect-Python-OidcService
src/oidcservice/oidc/access_token.py
AccessToken.gather_verify_arguments
def gather_verify_arguments(self): """ Need to add some information before running verify() :return: dictionary with arguments to the verify call """ _ctx = self.service_context kwargs = { 'client_id': _ctx.client_id, 'iss': _ctx.issuer, 'keyjar':...
python
def gather_verify_arguments(self): """ Need to add some information before running verify() :return: dictionary with arguments to the verify call """ _ctx = self.service_context kwargs = { 'client_id': _ctx.client_id, 'iss': _ctx.issuer, 'keyjar':...
[ "def", "gather_verify_arguments", "(", "self", ")", ":", "_ctx", "=", "self", ".", "service_context", "kwargs", "=", "{", "'client_id'", ":", "_ctx", ".", "client_id", ",", "'iss'", ":", "_ctx", ".", "issuer", ",", "'keyjar'", ":", "_ctx", ".", "keyjar", ...
Need to add some information before running verify() :return: dictionary with arguments to the verify call
[ "Need", "to", "add", "some", "information", "before", "running", "verify", "()" ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/oidc/access_token.py#L27-L52
openid/JWTConnect-Python-OidcService
src/oidcservice/oauth2/authorization.py
Authorization.post_parse_response
def post_parse_response(self, response, **kwargs): """ Add scope claim to response, from the request, if not present in the response :param response: The response :param kwargs: Extra Keyword arguments :return: A possibly augmented response """ if "scope...
python
def post_parse_response(self, response, **kwargs): """ Add scope claim to response, from the request, if not present in the response :param response: The response :param kwargs: Extra Keyword arguments :return: A possibly augmented response """ if "scope...
[ "def", "post_parse_response", "(", "self", ",", "response", ",", "*", "*", "kwargs", ")", ":", "if", "\"scope\"", "not", "in", "response", ":", "try", ":", "_key", "=", "kwargs", "[", "'state'", "]", "except", "KeyError", ":", "pass", "else", ":", "if"...
Add scope claim to response, from the request, if not present in the response :param response: The response :param kwargs: Extra Keyword arguments :return: A possibly augmented response
[ "Add", "scope", "claim", "to", "response", "from", "the", "request", "if", "not", "present", "in", "the", "response" ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/oauth2/authorization.py#L54-L77
openid/JWTConnect-Python-OidcService
src/oidcservice/oidc/end_session.py
EndSession.get_id_token_hint
def get_id_token_hint(self, request_args=None, **kwargs): """ Add id_token_hint to request :param request_args: :param kwargs: :return: """ request_args = self.multiple_extend_request_args( request_args, kwargs['state'], ['id_token'], ['au...
python
def get_id_token_hint(self, request_args=None, **kwargs): """ Add id_token_hint to request :param request_args: :param kwargs: :return: """ request_args = self.multiple_extend_request_args( request_args, kwargs['state'], ['id_token'], ['au...
[ "def", "get_id_token_hint", "(", "self", ",", "request_args", "=", "None", ",", "*", "*", "kwargs", ")", ":", "request_args", "=", "self", ".", "multiple_extend_request_args", "(", "request_args", ",", "kwargs", "[", "'state'", "]", ",", "[", "'id_token'", "...
Add id_token_hint to request :param request_args: :param kwargs: :return:
[ "Add", "id_token_hint", "to", "request" ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/oidc/end_session.py#L32-L53
openid/JWTConnect-Python-OidcService
src/oidcservice/state_interface.py
StateInterface.get_state
def get_state(self, key): """ Get the state connected to a given key. :param key: Key into the state database :return: A :py:class:´oidcservice.state_interface.State` instance """ _data = self.state_db.get(key) if not _data: raise KeyError(key) ...
python
def get_state(self, key): """ Get the state connected to a given key. :param key: Key into the state database :return: A :py:class:´oidcservice.state_interface.State` instance """ _data = self.state_db.get(key) if not _data: raise KeyError(key) ...
[ "def", "get_state", "(", "self", ",", "key", ")", ":", "_data", "=", "self", ".", "state_db", ".", "get", "(", "key", ")", "if", "not", "_data", ":", "raise", "KeyError", "(", "key", ")", "else", ":", "return", "State", "(", ")", ".", "from_json", ...
Get the state connected to a given key. :param key: Key into the state database :return: A :py:class:´oidcservice.state_interface.State` instance
[ "Get", "the", "state", "connected", "to", "a", "given", "key", "." ]
train
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/state_interface.py#L56-L67