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 |
|---|---|---|---|---|---|---|---|---|---|---|
aouyar/PyMunin | pysysinfo/filesystem.py | FilesystemInfo.getSpaceUse | def getSpaceUse(self):
"""Get disk space usage.
@return: Dictionary of filesystem space utilization stats for filesystems.
"""
stats = {}
try:
out = subprocess.Popen([dfCmd, "-Pk"],
stdout=subprocess.PIPE).communic... | python | def getSpaceUse(self):
"""Get disk space usage.
@return: Dictionary of filesystem space utilization stats for filesystems.
"""
stats = {}
try:
out = subprocess.Popen([dfCmd, "-Pk"],
stdout=subprocess.PIPE).communic... | [
"def",
"getSpaceUse",
"(",
"self",
")",
":",
"stats",
"=",
"{",
"}",
"try",
":",
"out",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"dfCmd",
",",
"\"-Pk\"",
"]",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
")",
".",
"communicate",
"(",
")",
"[",
... | Get disk space usage.
@return: Dictionary of filesystem space utilization stats for filesystems. | [
"Get",
"disk",
"space",
"usage",
"."
] | train | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/filesystem.py#L67-L91 |
aouyar/PyMunin | pymunin/plugins/pgstats.py | MuninPgPlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
stats = self._dbconn.getDatabaseStats()
databases = stats.get('databases')
totals = stats.get('totals')
if self.hasGraph('pg_connections'):
limit = self._dbconn.getParam('max_connections')
... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
stats = self._dbconn.getDatabaseStats()
databases = stats.get('databases')
totals = stats.get('totals')
if self.hasGraph('pg_connections'):
limit = self._dbconn.getParam('max_connections')
... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"stats",
"=",
"self",
".",
"_dbconn",
".",
"getDatabaseStats",
"(",
")",
"databases",
"=",
"stats",
".",
"get",
"(",
"'databases'",
")",
"totals",
"=",
"stats",
".",
"get",
"(",
"'totals'",
")",
"if",
"self... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | train | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/pgstats.py#L389-L486 |
swilson/aqualogic | aqualogic/core.py | AquaLogic.connect | def connect(self, host, port):
"""Connects via a RS-485 to Ethernet adapter."""
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host, port))
self._reader = sock.makefile(mode='rb')
self._writer = sock.makefile(mode='wb') | python | def connect(self, host, port):
"""Connects via a RS-485 to Ethernet adapter."""
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host, port))
self._reader = sock.makefile(mode='rb')
self._writer = sock.makefile(mode='wb') | [
"def",
"connect",
"(",
"self",
",",
"host",
",",
"port",
")",
":",
"sock",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_INET",
",",
"socket",
".",
"SOCK_STREAM",
")",
"sock",
".",
"connect",
"(",
"(",
"host",
",",
"port",
")",
")",
"self",... | Connects via a RS-485 to Ethernet adapter. | [
"Connects",
"via",
"a",
"RS",
"-",
"485",
"to",
"Ethernet",
"adapter",
"."
] | train | https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L104-L109 |
swilson/aqualogic | aqualogic/core.py | AquaLogic.process | def process(self, data_changed_callback):
"""Process data; returns when the reader signals EOF.
Callback is notified when any data changes."""
# pylint: disable=too-many-locals,too-many-branches,too-many-statements
while True:
byte = self._reader.read(1)
while Tr... | python | def process(self, data_changed_callback):
"""Process data; returns when the reader signals EOF.
Callback is notified when any data changes."""
# pylint: disable=too-many-locals,too-many-branches,too-many-statements
while True:
byte = self._reader.read(1)
while Tr... | [
"def",
"process",
"(",
"self",
",",
"data_changed_callback",
")",
":",
"# pylint: disable=too-many-locals,too-many-branches,too-many-statements",
"while",
"True",
":",
"byte",
"=",
"self",
".",
"_reader",
".",
"read",
"(",
"1",
")",
"while",
"True",
":",
"# Search f... | Process data; returns when the reader signals EOF.
Callback is notified when any data changes. | [
"Process",
"data",
";",
"returns",
"when",
"the",
"reader",
"signals",
"EOF",
".",
"Callback",
"is",
"notified",
"when",
"any",
"data",
"changes",
"."
] | train | https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L125-L292 |
swilson/aqualogic | aqualogic/core.py | AquaLogic.send_key | def send_key(self, key):
"""Sends a key."""
_LOGGER.info('Queueing key %s', key)
frame = self._get_key_event_frame(key)
# Queue it to send immediately following the reception
# of a keep-alive packet in an attempt to avoid bus collisions.
self._send_queue.put({'frame': f... | python | def send_key(self, key):
"""Sends a key."""
_LOGGER.info('Queueing key %s', key)
frame = self._get_key_event_frame(key)
# Queue it to send immediately following the reception
# of a keep-alive packet in an attempt to avoid bus collisions.
self._send_queue.put({'frame': f... | [
"def",
"send_key",
"(",
"self",
",",
"key",
")",
":",
"_LOGGER",
".",
"info",
"(",
"'Queueing key %s'",
",",
"key",
")",
"frame",
"=",
"self",
".",
"_get_key_event_frame",
"(",
"key",
")",
"# Queue it to send immediately following the reception",
"# of a keep-alive ... | Sends a key. | [
"Sends",
"a",
"key",
"."
] | train | https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L319-L326 |
swilson/aqualogic | aqualogic/core.py | AquaLogic.states | def states(self):
"""Returns a set containing the enabled states."""
state_list = []
for state in States:
if state.value & self._states != 0:
state_list.append(state)
if (self._flashing_states & States.FILTER) != 0:
state_list.append(States.FILTER... | python | def states(self):
"""Returns a set containing the enabled states."""
state_list = []
for state in States:
if state.value & self._states != 0:
state_list.append(state)
if (self._flashing_states & States.FILTER) != 0:
state_list.append(States.FILTER... | [
"def",
"states",
"(",
"self",
")",
":",
"state_list",
"=",
"[",
"]",
"for",
"state",
"in",
"States",
":",
"if",
"state",
".",
"value",
"&",
"self",
".",
"_states",
"!=",
"0",
":",
"state_list",
".",
"append",
"(",
"state",
")",
"if",
"(",
"self",
... | Returns a set containing the enabled states. | [
"Returns",
"a",
"set",
"containing",
"the",
"enabled",
"states",
"."
] | train | https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L392-L402 |
swilson/aqualogic | aqualogic/core.py | AquaLogic.get_state | def get_state(self, state):
"""Returns True if the specified state is enabled."""
# Check to see if we have a change request pending; if we do
# return the value we expect it to change to.
for data in list(self._send_queue.queue):
desired_states = data['desired_states']
... | python | def get_state(self, state):
"""Returns True if the specified state is enabled."""
# Check to see if we have a change request pending; if we do
# return the value we expect it to change to.
for data in list(self._send_queue.queue):
desired_states = data['desired_states']
... | [
"def",
"get_state",
"(",
"self",
",",
"state",
")",
":",
"# Check to see if we have a change request pending; if we do",
"# return the value we expect it to change to.",
"for",
"data",
"in",
"list",
"(",
"self",
".",
"_send_queue",
".",
"queue",
")",
":",
"desired_states"... | Returns True if the specified state is enabled. | [
"Returns",
"True",
"if",
"the",
"specified",
"state",
"is",
"enabled",
"."
] | train | https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L404-L415 |
swilson/aqualogic | aqualogic/core.py | AquaLogic.set_state | def set_state(self, state, enable):
"""Set the state."""
is_enabled = self.get_state(state)
if is_enabled == enable:
return True
key = None
desired_states = [{'state': state, 'enabled': not is_enabled}]
if state == States.FILTER_LOW_SPEED:
if no... | python | def set_state(self, state, enable):
"""Set the state."""
is_enabled = self.get_state(state)
if is_enabled == enable:
return True
key = None
desired_states = [{'state': state, 'enabled': not is_enabled}]
if state == States.FILTER_LOW_SPEED:
if no... | [
"def",
"set_state",
"(",
"self",
",",
"state",
",",
"enable",
")",
":",
"is_enabled",
"=",
"self",
".",
"get_state",
"(",
"state",
")",
"if",
"is_enabled",
"==",
"enable",
":",
"return",
"True",
"key",
"=",
"None",
"desired_states",
"=",
"[",
"{",
"'st... | Set the state. | [
"Set",
"the",
"state",
"."
] | train | https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L417-L455 |
vokimon/python-qgmap | qgmap/__init__.py | trace | def trace(function, *args, **k) :
"""Decorates a function by tracing the begining and
end of the function execution, if doTrace global is True"""
if doTrace : print ("> "+function.__name__, args, k)
result = function(*args, **k)
if doTrace : print ("< "+function.__name__, args, k, "->", result)
return result | python | def trace(function, *args, **k) :
"""Decorates a function by tracing the begining and
end of the function execution, if doTrace global is True"""
if doTrace : print ("> "+function.__name__, args, k)
result = function(*args, **k)
if doTrace : print ("< "+function.__name__, args, k, "->", result)
return result | [
"def",
"trace",
"(",
"function",
",",
"*",
"args",
",",
"*",
"*",
"k",
")",
":",
"if",
"doTrace",
":",
"print",
"(",
"\"> \"",
"+",
"function",
".",
"__name__",
",",
"args",
",",
"k",
")",
"result",
"=",
"function",
"(",
"*",
"args",
",",
"*",
... | Decorates a function by tracing the begining and
end of the function execution, if doTrace global is True | [
"Decorates",
"a",
"function",
"by",
"tracing",
"the",
"begining",
"and",
"end",
"of",
"the",
"function",
"execution",
"if",
"doTrace",
"global",
"is",
"True"
] | train | https://github.com/vokimon/python-qgmap/blob/9b01b48c5a8f4726938d38326f89644e7fb95f51/qgmap/__init__.py#L18-L25 |
vokimon/python-qgmap | qgmap/__init__.py | GeoCoder.geocode | def geocode(self, location) :
url = QtCore.QUrl("http://maps.googleapis.com/maps/api/geocode/xml")
url.addQueryItem("address", location)
url.addQueryItem("sensor", "false")
"""
url = QtCore.QUrl("http://maps.google.com/maps/geo/")
url.addQueryItem("q", location)
url.addQueryItem("output", "csv")
url.add... | python | def geocode(self, location) :
url = QtCore.QUrl("http://maps.googleapis.com/maps/api/geocode/xml")
url.addQueryItem("address", location)
url.addQueryItem("sensor", "false")
"""
url = QtCore.QUrl("http://maps.google.com/maps/geo/")
url.addQueryItem("q", location)
url.addQueryItem("output", "csv")
url.add... | [
"def",
"geocode",
"(",
"self",
",",
"location",
")",
":",
"url",
"=",
"QtCore",
".",
"QUrl",
"(",
"\"http://maps.googleapis.com/maps/api/geocode/xml\"",
")",
"url",
".",
"addQueryItem",
"(",
"\"address\"",
",",
"location",
")",
"url",
".",
"addQueryItem",
"(",
... | url = QtCore.QUrl("http://maps.google.com/maps/geo/")
url.addQueryItem("q", location)
url.addQueryItem("output", "csv")
url.addQueryItem("sensor", "false") | [
"url",
"=",
"QtCore",
".",
"QUrl",
"(",
"http",
":",
"//",
"maps",
".",
"google",
".",
"com",
"/",
"maps",
"/",
"geo",
"/",
")",
"url",
".",
"addQueryItem",
"(",
"q",
"location",
")",
"url",
".",
"addQueryItem",
"(",
"output",
"csv",
")",
"url",
... | train | https://github.com/vokimon/python-qgmap/blob/9b01b48c5a8f4726938d38326f89644e7fb95f51/qgmap/__init__.py#L40-L57 |
tisimst/mcerp | mcerp/correlate.py | correlate | def correlate(params, corrmat):
"""
Force a correlation matrix on a set of statistically distributed objects.
This function works on objects in-place.
Parameters
----------
params : array
An array of of uv objects.
corrmat : 2d-array
The correlation matrix to b... | python | def correlate(params, corrmat):
"""
Force a correlation matrix on a set of statistically distributed objects.
This function works on objects in-place.
Parameters
----------
params : array
An array of of uv objects.
corrmat : 2d-array
The correlation matrix to b... | [
"def",
"correlate",
"(",
"params",
",",
"corrmat",
")",
":",
"# Make sure all inputs are compatible\r",
"assert",
"all",
"(",
"[",
"isinstance",
"(",
"param",
",",
"UncertainFunction",
")",
"for",
"param",
"in",
"params",
"]",
")",
",",
"'All inputs to \"correlate... | Force a correlation matrix on a set of statistically distributed objects.
This function works on objects in-place.
Parameters
----------
params : array
An array of of uv objects.
corrmat : 2d-array
The correlation matrix to be imposed | [
"Force",
"a",
"correlation",
"matrix",
"on",
"a",
"set",
"of",
"statistically",
"distributed",
"objects",
".",
"This",
"function",
"works",
"on",
"objects",
"in",
"-",
"place",
".",
"Parameters",
"----------",
"params",
":",
"array",
"An",
"array",
"of",
"of... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/correlate.py#L8-L34 |
tisimst/mcerp | mcerp/correlate.py | induce_correlations | def induce_correlations(data, corrmat):
"""
Induce a set of correlations on a column-wise dataset
Parameters
----------
data : 2d-array
An m-by-n array where m is the number of samples and n is the
number of independent variables, each column of the array corresponding
... | python | def induce_correlations(data, corrmat):
"""
Induce a set of correlations on a column-wise dataset
Parameters
----------
data : 2d-array
An m-by-n array where m is the number of samples and n is the
number of independent variables, each column of the array corresponding
... | [
"def",
"induce_correlations",
"(",
"data",
",",
"corrmat",
")",
":",
"# Create an rank-matrix\r",
"data_rank",
"=",
"np",
".",
"vstack",
"(",
"[",
"rankdata",
"(",
"datai",
")",
"for",
"datai",
"in",
"data",
".",
"T",
"]",
")",
".",
"T",
"# Generate van de... | Induce a set of correlations on a column-wise dataset
Parameters
----------
data : 2d-array
An m-by-n array where m is the number of samples and n is the
number of independent variables, each column of the array corresponding
to each variable
corrmat : 2d-array
... | [
"Induce",
"a",
"set",
"of",
"correlations",
"on",
"a",
"column",
"-",
"wise",
"dataset",
"Parameters",
"----------",
"data",
":",
"2d",
"-",
"array",
"An",
"m",
"-",
"by",
"-",
"n",
"array",
"where",
"m",
"is",
"the",
"number",
"of",
"samples",
"and",
... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/correlate.py#L37-L95 |
tisimst/mcerp | mcerp/correlate.py | plotcorr | def plotcorr(X, plotargs=None, full=True, labels=None):
"""
Plots a scatterplot matrix of subplots.
Usage:
plotcorr(X)
plotcorr(..., plotargs=...) # e.g., 'r*', 'bo', etc.
plotcorr(..., full=...) # e.g., True or False
plotc... | python | def plotcorr(X, plotargs=None, full=True, labels=None):
"""
Plots a scatterplot matrix of subplots.
Usage:
plotcorr(X)
plotcorr(..., plotargs=...) # e.g., 'r*', 'bo', etc.
plotcorr(..., full=...) # e.g., True or False
plotc... | [
"def",
"plotcorr",
"(",
"X",
",",
"plotargs",
"=",
"None",
",",
"full",
"=",
"True",
",",
"labels",
"=",
"None",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"X",
"=",
"[",
"Xi",
".",
"_mcpts",
"if",
"isinstance",
"(",
"Xi",
",",
... | Plots a scatterplot matrix of subplots.
Usage:
plotcorr(X)
plotcorr(..., plotargs=...) # e.g., 'r*', 'bo', etc.
plotcorr(..., full=...) # e.g., True or False
plotcorr(..., labels=...) # e.g., ['label1', 'label2', ...]
Each co... | [
"Plots",
"a",
"scatterplot",
"matrix",
"of",
"subplots",
".",
"Usage",
":",
"plotcorr",
"(",
"X",
")",
"plotcorr",
"(",
"...",
"plotargs",
"=",
"...",
")",
"#",
"e",
".",
"g",
".",
"r",
"*",
"bo",
"etc",
".",
"plotcorr",
"(",
"...",
"full",
"=",
... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/correlate.py#L98-L201 |
tisimst/mcerp | mcerp/correlate.py | chol | def chol(A):
"""
Calculate the lower triangular matrix of the Cholesky decomposition of
a symmetric, positive-definite matrix.
"""
A = np.array(A)
assert A.shape[0] == A.shape[1], "Input matrix must be square"
L = [[0.0] * len(A) for _ in range(len(A))]
for i in range(len(A)):
... | python | def chol(A):
"""
Calculate the lower triangular matrix of the Cholesky decomposition of
a symmetric, positive-definite matrix.
"""
A = np.array(A)
assert A.shape[0] == A.shape[1], "Input matrix must be square"
L = [[0.0] * len(A) for _ in range(len(A))]
for i in range(len(A)):
... | [
"def",
"chol",
"(",
"A",
")",
":",
"A",
"=",
"np",
".",
"array",
"(",
"A",
")",
"assert",
"A",
".",
"shape",
"[",
"0",
"]",
"==",
"A",
".",
"shape",
"[",
"1",
"]",
",",
"\"Input matrix must be square\"",
"L",
"=",
"[",
"[",
"0.0",
"]",
"*",
"... | Calculate the lower triangular matrix of the Cholesky decomposition of
a symmetric, positive-definite matrix. | [
"Calculate",
"the",
"lower",
"triangular",
"matrix",
"of",
"the",
"Cholesky",
"decomposition",
"of",
"a",
"symmetric",
"positive",
"-",
"definite",
"matrix",
"."
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/correlate.py#L204-L220 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.get | def get(self, uri, params={}):
'''A generic method to make GET requests to the OpenDNS Investigate API
on the given URI.
'''
return self._session.get(urljoin(Investigate.BASE_URL, uri),
params=params, headers=self._auth_header, proxies=self.proxies
) | python | def get(self, uri, params={}):
'''A generic method to make GET requests to the OpenDNS Investigate API
on the given URI.
'''
return self._session.get(urljoin(Investigate.BASE_URL, uri),
params=params, headers=self._auth_header, proxies=self.proxies
) | [
"def",
"get",
"(",
"self",
",",
"uri",
",",
"params",
"=",
"{",
"}",
")",
":",
"return",
"self",
".",
"_session",
".",
"get",
"(",
"urljoin",
"(",
"Investigate",
".",
"BASE_URL",
",",
"uri",
")",
",",
"params",
"=",
"params",
",",
"headers",
"=",
... | A generic method to make GET requests to the OpenDNS Investigate API
on the given URI. | [
"A",
"generic",
"method",
"to",
"make",
"GET",
"requests",
"to",
"the",
"OpenDNS",
"Investigate",
"API",
"on",
"the",
"given",
"URI",
"."
] | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L62-L68 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.post | def post(self, uri, params={}, data={}):
'''A generic method to make POST requests to the OpenDNS Investigate API
on the given URI.
'''
return self._session.post(
urljoin(Investigate.BASE_URL, uri),
params=params, data=data, headers=self._auth_header,
... | python | def post(self, uri, params={}, data={}):
'''A generic method to make POST requests to the OpenDNS Investigate API
on the given URI.
'''
return self._session.post(
urljoin(Investigate.BASE_URL, uri),
params=params, data=data, headers=self._auth_header,
... | [
"def",
"post",
"(",
"self",
",",
"uri",
",",
"params",
"=",
"{",
"}",
",",
"data",
"=",
"{",
"}",
")",
":",
"return",
"self",
".",
"_session",
".",
"post",
"(",
"urljoin",
"(",
"Investigate",
".",
"BASE_URL",
",",
"uri",
")",
",",
"params",
"=",
... | A generic method to make POST requests to the OpenDNS Investigate API
on the given URI. | [
"A",
"generic",
"method",
"to",
"make",
"POST",
"requests",
"to",
"the",
"OpenDNS",
"Investigate",
"API",
"on",
"the",
"given",
"URI",
"."
] | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L70-L78 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.get_parse | def get_parse(self, uri, params={}):
'''Convenience method to call get() on an arbitrary URI and parse the response
into a JSON object. Raises an error on non-200 response status.
'''
return self._request_parse(self.get, uri, params) | python | def get_parse(self, uri, params={}):
'''Convenience method to call get() on an arbitrary URI and parse the response
into a JSON object. Raises an error on non-200 response status.
'''
return self._request_parse(self.get, uri, params) | [
"def",
"get_parse",
"(",
"self",
",",
"uri",
",",
"params",
"=",
"{",
"}",
")",
":",
"return",
"self",
".",
"_request_parse",
"(",
"self",
".",
"get",
",",
"uri",
",",
"params",
")"
] | Convenience method to call get() on an arbitrary URI and parse the response
into a JSON object. Raises an error on non-200 response status. | [
"Convenience",
"method",
"to",
"call",
"get",
"()",
"on",
"an",
"arbitrary",
"URI",
"and",
"parse",
"the",
"response",
"into",
"a",
"JSON",
"object",
".",
"Raises",
"an",
"error",
"on",
"non",
"-",
"200",
"response",
"status",
"."
] | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L85-L89 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.post_parse | def post_parse(self, uri, params={}, data={}):
'''Convenience method to call post() on an arbitrary URI and parse the response
into a JSON object. Raises an error on non-200 response status.
'''
return self._request_parse(self.post, uri, params, data) | python | def post_parse(self, uri, params={}, data={}):
'''Convenience method to call post() on an arbitrary URI and parse the response
into a JSON object. Raises an error on non-200 response status.
'''
return self._request_parse(self.post, uri, params, data) | [
"def",
"post_parse",
"(",
"self",
",",
"uri",
",",
"params",
"=",
"{",
"}",
",",
"data",
"=",
"{",
"}",
")",
":",
"return",
"self",
".",
"_request_parse",
"(",
"self",
".",
"post",
",",
"uri",
",",
"params",
",",
"data",
")"
] | Convenience method to call post() on an arbitrary URI and parse the response
into a JSON object. Raises an error on non-200 response status. | [
"Convenience",
"method",
"to",
"call",
"post",
"()",
"on",
"an",
"arbitrary",
"URI",
"and",
"parse",
"the",
"response",
"into",
"a",
"JSON",
"object",
".",
"Raises",
"an",
"error",
"on",
"non",
"-",
"200",
"response",
"status",
"."
] | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L91-L95 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.categorization | def categorization(self, domains, labels=False):
'''Get the domain status and categorization of a domain or list of domains.
'domains' can be either a single domain, or a list of domains.
Setting 'labels' to True will give back categorizations in human-readable
form.
For more de... | python | def categorization(self, domains, labels=False):
'''Get the domain status and categorization of a domain or list of domains.
'domains' can be either a single domain, or a list of domains.
Setting 'labels' to True will give back categorizations in human-readable
form.
For more de... | [
"def",
"categorization",
"(",
"self",
",",
"domains",
",",
"labels",
"=",
"False",
")",
":",
"if",
"type",
"(",
"domains",
")",
"is",
"str",
":",
"return",
"self",
".",
"_get_categorization",
"(",
"domains",
",",
"labels",
")",
"elif",
"type",
"(",
"do... | Get the domain status and categorization of a domain or list of domains.
'domains' can be either a single domain, or a list of domains.
Setting 'labels' to True will give back categorizations in human-readable
form.
For more detail, see https://investigate.umbrella.com/docs/api#categori... | [
"Get",
"the",
"domain",
"status",
"and",
"categorization",
"of",
"a",
"domain",
"or",
"list",
"of",
"domains",
".",
"domains",
"can",
"be",
"either",
"a",
"single",
"domain",
"or",
"a",
"list",
"of",
"domains",
".",
"Setting",
"labels",
"to",
"True",
"wi... | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L108-L121 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.cooccurrences | def cooccurrences(self, domain):
'''Get the cooccurrences of the given domain.
For details, see https://investigate.umbrella.com/docs/api#co-occurrences
'''
uri = self._uris["cooccurrences"].format(domain)
return self.get_parse(uri) | python | def cooccurrences(self, domain):
'''Get the cooccurrences of the given domain.
For details, see https://investigate.umbrella.com/docs/api#co-occurrences
'''
uri = self._uris["cooccurrences"].format(domain)
return self.get_parse(uri) | [
"def",
"cooccurrences",
"(",
"self",
",",
"domain",
")",
":",
"uri",
"=",
"self",
".",
"_uris",
"[",
"\"cooccurrences\"",
"]",
".",
"format",
"(",
"domain",
")",
"return",
"self",
".",
"get_parse",
"(",
"uri",
")"
] | Get the cooccurrences of the given domain.
For details, see https://investigate.umbrella.com/docs/api#co-occurrences | [
"Get",
"the",
"cooccurrences",
"of",
"the",
"given",
"domain",
"."
] | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L123-L129 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.related | def related(self, domain):
'''Get the related domains of the given domain.
For details, see https://investigate.umbrella.com/docs/api#relatedDomains
'''
uri = self._uris["related"].format(domain)
return self.get_parse(uri) | python | def related(self, domain):
'''Get the related domains of the given domain.
For details, see https://investigate.umbrella.com/docs/api#relatedDomains
'''
uri = self._uris["related"].format(domain)
return self.get_parse(uri) | [
"def",
"related",
"(",
"self",
",",
"domain",
")",
":",
"uri",
"=",
"self",
".",
"_uris",
"[",
"\"related\"",
"]",
".",
"format",
"(",
"domain",
")",
"return",
"self",
".",
"get_parse",
"(",
"uri",
")"
] | Get the related domains of the given domain.
For details, see https://investigate.umbrella.com/docs/api#relatedDomains | [
"Get",
"the",
"related",
"domains",
"of",
"the",
"given",
"domain",
"."
] | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L131-L137 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.security | def security(self, domain):
'''Get the Security Information for the given domain.
For details, see https://investigate.umbrella.com/docs/api#securityInfo
'''
uri = self._uris["security"].format(domain)
return self.get_parse(uri) | python | def security(self, domain):
'''Get the Security Information for the given domain.
For details, see https://investigate.umbrella.com/docs/api#securityInfo
'''
uri = self._uris["security"].format(domain)
return self.get_parse(uri) | [
"def",
"security",
"(",
"self",
",",
"domain",
")",
":",
"uri",
"=",
"self",
".",
"_uris",
"[",
"\"security\"",
"]",
".",
"format",
"(",
"domain",
")",
"return",
"self",
".",
"get_parse",
"(",
"uri",
")"
] | Get the Security Information for the given domain.
For details, see https://investigate.umbrella.com/docs/api#securityInfo | [
"Get",
"the",
"Security",
"Information",
"for",
"the",
"given",
"domain",
"."
] | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L139-L145 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.rr_history | def rr_history(self, query, query_type="A"):
'''Get the RR (Resource Record) History of the given domain or IP.
The default query type is for 'A' records, but the following query types
are supported:
A, NS, MX, TXT, CNAME
For details, see https://investigate.umbrella.com/docs/a... | python | def rr_history(self, query, query_type="A"):
'''Get the RR (Resource Record) History of the given domain or IP.
The default query type is for 'A' records, but the following query types
are supported:
A, NS, MX, TXT, CNAME
For details, see https://investigate.umbrella.com/docs/a... | [
"def",
"rr_history",
"(",
"self",
",",
"query",
",",
"query_type",
"=",
"\"A\"",
")",
":",
"if",
"query_type",
"not",
"in",
"Investigate",
".",
"SUPPORTED_DNS_TYPES",
":",
"raise",
"Investigate",
".",
"UNSUPPORTED_DNS_QUERY",
"# if this is an IP address, query the IP"... | Get the RR (Resource Record) History of the given domain or IP.
The default query type is for 'A' records, but the following query types
are supported:
A, NS, MX, TXT, CNAME
For details, see https://investigate.umbrella.com/docs/api#dnsrr_domain | [
"Get",
"the",
"RR",
"(",
"Resource",
"Record",
")",
"History",
"of",
"the",
"given",
"domain",
"or",
"IP",
".",
"The",
"default",
"query",
"type",
"is",
"for",
"A",
"records",
"but",
"the",
"following",
"query",
"types",
"are",
"supported",
":"
] | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L155-L172 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.domain_whois | def domain_whois(self, domain):
'''Gets whois information for a domain'''
uri = self._uris["whois_domain"].format(domain)
resp_json = self.get_parse(uri)
return resp_json | python | def domain_whois(self, domain):
'''Gets whois information for a domain'''
uri = self._uris["whois_domain"].format(domain)
resp_json = self.get_parse(uri)
return resp_json | [
"def",
"domain_whois",
"(",
"self",
",",
"domain",
")",
":",
"uri",
"=",
"self",
".",
"_uris",
"[",
"\"whois_domain\"",
"]",
".",
"format",
"(",
"domain",
")",
"resp_json",
"=",
"self",
".",
"get_parse",
"(",
"uri",
")",
"return",
"resp_json"
] | Gets whois information for a domain | [
"Gets",
"whois",
"information",
"for",
"a",
"domain"
] | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L187-L191 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.domain_whois_history | def domain_whois_history(self, domain, limit=None):
'''Gets whois history for a domain'''
params = dict()
if limit is not None:
params['limit'] = limit
uri = self._uris["whois_domain_history"].format(domain)
resp_json = self.get_parse(uri, params)
return res... | python | def domain_whois_history(self, domain, limit=None):
'''Gets whois history for a domain'''
params = dict()
if limit is not None:
params['limit'] = limit
uri = self._uris["whois_domain_history"].format(domain)
resp_json = self.get_parse(uri, params)
return res... | [
"def",
"domain_whois_history",
"(",
"self",
",",
"domain",
",",
"limit",
"=",
"None",
")",
":",
"params",
"=",
"dict",
"(",
")",
"if",
"limit",
"is",
"not",
"None",
":",
"params",
"[",
"'limit'",
"]",
"=",
"limit",
"uri",
"=",
"self",
".",
"_uris",
... | Gets whois history for a domain | [
"Gets",
"whois",
"history",
"for",
"a",
"domain"
] | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L193-L202 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.ns_whois | def ns_whois(self, nameservers, limit=DEFAULT_LIMIT, offset=DEFAULT_OFFSET, sort_field=DEFAULT_SORT):
'''Gets the domains that have been registered with a nameserver or
nameservers'''
if not isinstance(nameservers, list):
uri = self._uris["whois_ns"].format(nameservers)
p... | python | def ns_whois(self, nameservers, limit=DEFAULT_LIMIT, offset=DEFAULT_OFFSET, sort_field=DEFAULT_SORT):
'''Gets the domains that have been registered with a nameserver or
nameservers'''
if not isinstance(nameservers, list):
uri = self._uris["whois_ns"].format(nameservers)
p... | [
"def",
"ns_whois",
"(",
"self",
",",
"nameservers",
",",
"limit",
"=",
"DEFAULT_LIMIT",
",",
"offset",
"=",
"DEFAULT_OFFSET",
",",
"sort_field",
"=",
"DEFAULT_SORT",
")",
":",
"if",
"not",
"isinstance",
"(",
"nameservers",
",",
"list",
")",
":",
"uri",
"="... | Gets the domains that have been registered with a nameserver or
nameservers | [
"Gets",
"the",
"domains",
"that",
"have",
"been",
"registered",
"with",
"a",
"nameserver",
"or",
"nameservers"
] | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L204-L215 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.search | def search(self, pattern, start=None, limit=None, include_category=None):
'''Searches for domains that match a given pattern'''
params = dict()
if start is None:
start = datetime.timedelta(days=30)
if isinstance(start, datetime.timedelta):
params['start'] = int... | python | def search(self, pattern, start=None, limit=None, include_category=None):
'''Searches for domains that match a given pattern'''
params = dict()
if start is None:
start = datetime.timedelta(days=30)
if isinstance(start, datetime.timedelta):
params['start'] = int... | [
"def",
"search",
"(",
"self",
",",
"pattern",
",",
"start",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"include_category",
"=",
"None",
")",
":",
"params",
"=",
"dict",
"(",
")",
"if",
"start",
"is",
"None",
":",
"start",
"=",
"datetime",
".",
"t... | Searches for domains that match a given pattern | [
"Searches",
"for",
"domains",
"that",
"match",
"a",
"given",
"pattern"
] | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L231-L253 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.samples | def samples(self, anystring, limit=None, offset=None, sortby=None):
'''Return an object representing the samples identified by the input domain, IP, or URL'''
uri = self._uris['samples'].format(anystring)
params = {'limit': limit, 'offset': offset, 'sortby': sortby}
return self.get_par... | python | def samples(self, anystring, limit=None, offset=None, sortby=None):
'''Return an object representing the samples identified by the input domain, IP, or URL'''
uri = self._uris['samples'].format(anystring)
params = {'limit': limit, 'offset': offset, 'sortby': sortby}
return self.get_par... | [
"def",
"samples",
"(",
"self",
",",
"anystring",
",",
"limit",
"=",
"None",
",",
"offset",
"=",
"None",
",",
"sortby",
"=",
"None",
")",
":",
"uri",
"=",
"self",
".",
"_uris",
"[",
"'samples'",
"]",
".",
"format",
"(",
"anystring",
")",
"params",
"... | Return an object representing the samples identified by the input domain, IP, or URL | [
"Return",
"an",
"object",
"representing",
"the",
"samples",
"identified",
"by",
"the",
"input",
"domain",
"IP",
"or",
"URL"
] | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L255-L261 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.sample | def sample(self, hash, limit=None, offset=None):
'''Return an object representing the sample identified by the input hash, or an empty object if that sample is not found'''
uri = self._uris['sample'].format(hash)
params = {'limit': limit, 'offset': offset}
return self.get_parse(uri, pa... | python | def sample(self, hash, limit=None, offset=None):
'''Return an object representing the sample identified by the input hash, or an empty object if that sample is not found'''
uri = self._uris['sample'].format(hash)
params = {'limit': limit, 'offset': offset}
return self.get_parse(uri, pa... | [
"def",
"sample",
"(",
"self",
",",
"hash",
",",
"limit",
"=",
"None",
",",
"offset",
"=",
"None",
")",
":",
"uri",
"=",
"self",
".",
"_uris",
"[",
"'sample'",
"]",
".",
"format",
"(",
"hash",
")",
"params",
"=",
"{",
"'limit'",
":",
"limit",
",",... | Return an object representing the sample identified by the input hash, or an empty object if that sample is not found | [
"Return",
"an",
"object",
"representing",
"the",
"sample",
"identified",
"by",
"the",
"input",
"hash",
"or",
"an",
"empty",
"object",
"if",
"that",
"sample",
"is",
"not",
"found"
] | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L263-L269 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.as_for_ip | def as_for_ip(self, ip):
'''Gets the AS information for a given IP address.'''
if not Investigate.IP_PATTERN.match(ip):
raise Investigate.IP_ERR
uri = self._uris["as_for_ip"].format(ip)
resp_json = self.get_parse(uri)
return resp_json | python | def as_for_ip(self, ip):
'''Gets the AS information for a given IP address.'''
if not Investigate.IP_PATTERN.match(ip):
raise Investigate.IP_ERR
uri = self._uris["as_for_ip"].format(ip)
resp_json = self.get_parse(uri)
return resp_json | [
"def",
"as_for_ip",
"(",
"self",
",",
"ip",
")",
":",
"if",
"not",
"Investigate",
".",
"IP_PATTERN",
".",
"match",
"(",
"ip",
")",
":",
"raise",
"Investigate",
".",
"IP_ERR",
"uri",
"=",
"self",
".",
"_uris",
"[",
"\"as_for_ip\"",
"]",
".",
"format",
... | Gets the AS information for a given IP address. | [
"Gets",
"the",
"AS",
"information",
"for",
"a",
"given",
"IP",
"address",
"."
] | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L298-L306 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.prefixes_for_asn | def prefixes_for_asn(self, asn):
'''Gets the AS information for a given ASN. Return the CIDR and geolocation associated with the AS.'''
uri = self._uris["prefixes_for_asn"].format(asn)
resp_json = self.get_parse(uri)
return resp_json | python | def prefixes_for_asn(self, asn):
'''Gets the AS information for a given ASN. Return the CIDR and geolocation associated with the AS.'''
uri = self._uris["prefixes_for_asn"].format(asn)
resp_json = self.get_parse(uri)
return resp_json | [
"def",
"prefixes_for_asn",
"(",
"self",
",",
"asn",
")",
":",
"uri",
"=",
"self",
".",
"_uris",
"[",
"\"prefixes_for_asn\"",
"]",
".",
"format",
"(",
"asn",
")",
"resp_json",
"=",
"self",
".",
"get_parse",
"(",
"uri",
")",
"return",
"resp_json"
] | Gets the AS information for a given ASN. Return the CIDR and geolocation associated with the AS. | [
"Gets",
"the",
"AS",
"information",
"for",
"a",
"given",
"ASN",
".",
"Return",
"the",
"CIDR",
"and",
"geolocation",
"associated",
"with",
"the",
"AS",
"."
] | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L308-L314 |
opendns/pyinvestigate | investigate/investigate.py | Investigate.timeline | def timeline(self, uri):
'''Get the domain tagging timeline for a given uri.
Could be a domain, ip, or url.
For details, see https://docs.umbrella.com/investigate-api/docs/timeline
'''
uri = self._uris["timeline"].format(uri)
resp_json = self.get_parse(uri)
retu... | python | def timeline(self, uri):
'''Get the domain tagging timeline for a given uri.
Could be a domain, ip, or url.
For details, see https://docs.umbrella.com/investigate-api/docs/timeline
'''
uri = self._uris["timeline"].format(uri)
resp_json = self.get_parse(uri)
retu... | [
"def",
"timeline",
"(",
"self",
",",
"uri",
")",
":",
"uri",
"=",
"self",
".",
"_uris",
"[",
"\"timeline\"",
"]",
".",
"format",
"(",
"uri",
")",
"resp_json",
"=",
"self",
".",
"get_parse",
"(",
"uri",
")",
"return",
"resp_json"
] | Get the domain tagging timeline for a given uri.
Could be a domain, ip, or url.
For details, see https://docs.umbrella.com/investigate-api/docs/timeline | [
"Get",
"the",
"domain",
"tagging",
"timeline",
"for",
"a",
"given",
"uri",
".",
"Could",
"be",
"a",
"domain",
"ip",
"or",
"url",
".",
"For",
"details",
"see",
"https",
":",
"//",
"docs",
".",
"umbrella",
".",
"com",
"/",
"investigate",
"-",
"api",
"/... | train | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L316-L324 |
tisimst/mcerp | mcerp/umath.py | abs | def abs(x):
"""
Absolute value
"""
if isinstance(x, UncertainFunction):
mcpts = np.abs(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.abs(x) | python | def abs(x):
"""
Absolute value
"""
if isinstance(x, UncertainFunction):
mcpts = np.abs(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.abs(x) | [
"def",
"abs",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"abs",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
"a... | Absolute value | [
"Absolute",
"value"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L18-L26 |
tisimst/mcerp | mcerp/umath.py | acos | def acos(x):
"""
Inverse cosine
"""
if isinstance(x, UncertainFunction):
mcpts = np.arccos(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arccos(x) | python | def acos(x):
"""
Inverse cosine
"""
if isinstance(x, UncertainFunction):
mcpts = np.arccos(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arccos(x) | [
"def",
"acos",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"arccos",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | Inverse cosine | [
"Inverse",
"cosine"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L29-L37 |
tisimst/mcerp | mcerp/umath.py | acosh | def acosh(x):
"""
Inverse hyperbolic cosine
"""
if isinstance(x, UncertainFunction):
mcpts = np.arccosh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arccosh(x) | python | def acosh(x):
"""
Inverse hyperbolic cosine
"""
if isinstance(x, UncertainFunction):
mcpts = np.arccosh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arccosh(x) | [
"def",
"acosh",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"arccosh",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
"."... | Inverse hyperbolic cosine | [
"Inverse",
"hyperbolic",
"cosine"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L40-L48 |
tisimst/mcerp | mcerp/umath.py | asin | def asin(x):
"""
Inverse sine
"""
if isinstance(x, UncertainFunction):
mcpts = np.arcsin(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arcsin(x) | python | def asin(x):
"""
Inverse sine
"""
if isinstance(x, UncertainFunction):
mcpts = np.arcsin(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arcsin(x) | [
"def",
"asin",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"arcsin",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | Inverse sine | [
"Inverse",
"sine"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L51-L59 |
tisimst/mcerp | mcerp/umath.py | asinh | def asinh(x):
"""
Inverse hyperbolic sine
"""
if isinstance(x, UncertainFunction):
mcpts = np.arcsinh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arcsinh(x) | python | def asinh(x):
"""
Inverse hyperbolic sine
"""
if isinstance(x, UncertainFunction):
mcpts = np.arcsinh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arcsinh(x) | [
"def",
"asinh",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"arcsinh",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
"."... | Inverse hyperbolic sine | [
"Inverse",
"hyperbolic",
"sine"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L62-L70 |
tisimst/mcerp | mcerp/umath.py | atan | def atan(x):
"""
Inverse tangent
"""
if isinstance(x, UncertainFunction):
mcpts = np.arctan(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arctan(x) | python | def atan(x):
"""
Inverse tangent
"""
if isinstance(x, UncertainFunction):
mcpts = np.arctan(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arctan(x) | [
"def",
"atan",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"arctan",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | Inverse tangent | [
"Inverse",
"tangent"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L73-L81 |
tisimst/mcerp | mcerp/umath.py | atanh | def atanh(x):
"""
Inverse hyperbolic tangent
"""
if isinstance(x, UncertainFunction):
mcpts = np.arctanh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arctanh(x) | python | def atanh(x):
"""
Inverse hyperbolic tangent
"""
if isinstance(x, UncertainFunction):
mcpts = np.arctanh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arctanh(x) | [
"def",
"atanh",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"arctanh",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
"."... | Inverse hyperbolic tangent | [
"Inverse",
"hyperbolic",
"tangent"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L84-L92 |
tisimst/mcerp | mcerp/umath.py | ceil | def ceil(x):
"""
Ceiling function (round towards positive infinity)
"""
if isinstance(x, UncertainFunction):
mcpts = np.ceil(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.ceil(x) | python | def ceil(x):
"""
Ceiling function (round towards positive infinity)
"""
if isinstance(x, UncertainFunction):
mcpts = np.ceil(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.ceil(x) | [
"def",
"ceil",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"ceil",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | Ceiling function (round towards positive infinity) | [
"Ceiling",
"function",
"(",
"round",
"towards",
"positive",
"infinity",
")"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L95-L103 |
tisimst/mcerp | mcerp/umath.py | cos | def cos(x):
"""
Cosine
"""
if isinstance(x, UncertainFunction):
mcpts = np.cos(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.cos(x) | python | def cos(x):
"""
Cosine
"""
if isinstance(x, UncertainFunction):
mcpts = np.cos(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.cos(x) | [
"def",
"cos",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"cos",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
"c... | Cosine | [
"Cosine"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L106-L114 |
tisimst/mcerp | mcerp/umath.py | cosh | def cosh(x):
"""
Hyperbolic cosine
"""
if isinstance(x, UncertainFunction):
mcpts = np.cosh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.cosh(x) | python | def cosh(x):
"""
Hyperbolic cosine
"""
if isinstance(x, UncertainFunction):
mcpts = np.cosh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.cosh(x) | [
"def",
"cosh",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"cosh",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | Hyperbolic cosine | [
"Hyperbolic",
"cosine"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L117-L125 |
tisimst/mcerp | mcerp/umath.py | degrees | def degrees(x):
"""
Convert radians to degrees
"""
if isinstance(x, UncertainFunction):
mcpts = np.degrees(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.degrees(x) | python | def degrees(x):
"""
Convert radians to degrees
"""
if isinstance(x, UncertainFunction):
mcpts = np.degrees(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.degrees(x) | [
"def",
"degrees",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"degrees",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
"... | Convert radians to degrees | [
"Convert",
"radians",
"to",
"degrees"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L128-L136 |
tisimst/mcerp | mcerp/umath.py | exp | def exp(x):
"""
Exponential function
"""
if isinstance(x, UncertainFunction):
mcpts = np.exp(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.exp(x) | python | def exp(x):
"""
Exponential function
"""
if isinstance(x, UncertainFunction):
mcpts = np.exp(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.exp(x) | [
"def",
"exp",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"exp",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
"e... | Exponential function | [
"Exponential",
"function"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L139-L147 |
tisimst/mcerp | mcerp/umath.py | expm1 | def expm1(x):
"""
Calculate exp(x) - 1
"""
if isinstance(x, UncertainFunction):
mcpts = np.expm1(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.expm1(x) | python | def expm1(x):
"""
Calculate exp(x) - 1
"""
if isinstance(x, UncertainFunction):
mcpts = np.expm1(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.expm1(x) | [
"def",
"expm1",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"expm1",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | Calculate exp(x) - 1 | [
"Calculate",
"exp",
"(",
"x",
")",
"-",
"1"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L150-L158 |
tisimst/mcerp | mcerp/umath.py | fabs | def fabs(x):
"""
Absolute value function
"""
if isinstance(x, UncertainFunction):
mcpts = np.fabs(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.fabs(x) | python | def fabs(x):
"""
Absolute value function
"""
if isinstance(x, UncertainFunction):
mcpts = np.fabs(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.fabs(x) | [
"def",
"fabs",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"fabs",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | Absolute value function | [
"Absolute",
"value",
"function"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L161-L169 |
tisimst/mcerp | mcerp/umath.py | floor | def floor(x):
"""
Floor function (round towards negative infinity)
"""
if isinstance(x, UncertainFunction):
mcpts = np.floor(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.floor(x) | python | def floor(x):
"""
Floor function (round towards negative infinity)
"""
if isinstance(x, UncertainFunction):
mcpts = np.floor(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.floor(x) | [
"def",
"floor",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"floor",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | Floor function (round towards negative infinity) | [
"Floor",
"function",
"(",
"round",
"towards",
"negative",
"infinity",
")"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L172-L180 |
tisimst/mcerp | mcerp/umath.py | hypot | def hypot(x, y):
"""
Calculate the hypotenuse given two "legs" of a right triangle
"""
if isinstance(x, UncertainFunction) or isinstance(x, UncertainFunction):
ufx = to_uncertain_func(x)
ufy = to_uncertain_func(y)
mcpts = np.hypot(ufx._mcpts, ufy._mcpts)
return UncertainF... | python | def hypot(x, y):
"""
Calculate the hypotenuse given two "legs" of a right triangle
"""
if isinstance(x, UncertainFunction) or isinstance(x, UncertainFunction):
ufx = to_uncertain_func(x)
ufy = to_uncertain_func(y)
mcpts = np.hypot(ufx._mcpts, ufy._mcpts)
return UncertainF... | [
"def",
"hypot",
"(",
"x",
",",
"y",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
"or",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"ufx",
"=",
"to_uncertain_func",
"(",
"x",
")",
"ufy",
"=",
"to_uncertain_func",
... | Calculate the hypotenuse given two "legs" of a right triangle | [
"Calculate",
"the",
"hypotenuse",
"given",
"two",
"legs",
"of",
"a",
"right",
"triangle"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L183-L193 |
tisimst/mcerp | mcerp/umath.py | log | def log(x):
"""
Natural logarithm
"""
if isinstance(x, UncertainFunction):
mcpts = np.log(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.log(x) | python | def log(x):
"""
Natural logarithm
"""
if isinstance(x, UncertainFunction):
mcpts = np.log(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.log(x) | [
"def",
"log",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"log",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
"l... | Natural logarithm | [
"Natural",
"logarithm"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L203-L211 |
tisimst/mcerp | mcerp/umath.py | log10 | def log10(x):
"""
Base-10 logarithm
"""
if isinstance(x, UncertainFunction):
mcpts = np.log10(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.log10(x) | python | def log10(x):
"""
Base-10 logarithm
"""
if isinstance(x, UncertainFunction):
mcpts = np.log10(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.log10(x) | [
"def",
"log10",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"log10",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | Base-10 logarithm | [
"Base",
"-",
"10",
"logarithm"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L214-L222 |
tisimst/mcerp | mcerp/umath.py | log1p | def log1p(x):
"""
Natural logarithm of (1 + x)
"""
if isinstance(x, UncertainFunction):
mcpts = np.log1p(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.log1p(x) | python | def log1p(x):
"""
Natural logarithm of (1 + x)
"""
if isinstance(x, UncertainFunction):
mcpts = np.log1p(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.log1p(x) | [
"def",
"log1p",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"log1p",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | Natural logarithm of (1 + x) | [
"Natural",
"logarithm",
"of",
"(",
"1",
"+",
"x",
")"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L225-L233 |
tisimst/mcerp | mcerp/umath.py | radians | def radians(x):
"""
Convert degrees to radians
"""
if isinstance(x, UncertainFunction):
mcpts = np.radians(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.radians(x) | python | def radians(x):
"""
Convert degrees to radians
"""
if isinstance(x, UncertainFunction):
mcpts = np.radians(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.radians(x) | [
"def",
"radians",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"radians",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
"... | Convert degrees to radians | [
"Convert",
"degrees",
"to",
"radians"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L236-L244 |
tisimst/mcerp | mcerp/umath.py | sin | def sin(x):
"""
Sine
"""
if isinstance(x, UncertainFunction):
mcpts = np.sin(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.sin(x) | python | def sin(x):
"""
Sine
"""
if isinstance(x, UncertainFunction):
mcpts = np.sin(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.sin(x) | [
"def",
"sin",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"sin",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
"s... | Sine | [
"Sine"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L247-L255 |
tisimst/mcerp | mcerp/umath.py | sinh | def sinh(x):
"""
Hyperbolic sine
"""
if isinstance(x, UncertainFunction):
mcpts = np.sinh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.sinh(x) | python | def sinh(x):
"""
Hyperbolic sine
"""
if isinstance(x, UncertainFunction):
mcpts = np.sinh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.sinh(x) | [
"def",
"sinh",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"sinh",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | Hyperbolic sine | [
"Hyperbolic",
"sine"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L258-L266 |
tisimst/mcerp | mcerp/umath.py | sqrt | def sqrt(x):
"""
Square-root function
"""
if isinstance(x, UncertainFunction):
mcpts = np.sqrt(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.sqrt(x) | python | def sqrt(x):
"""
Square-root function
"""
if isinstance(x, UncertainFunction):
mcpts = np.sqrt(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.sqrt(x) | [
"def",
"sqrt",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"sqrt",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | Square-root function | [
"Square",
"-",
"root",
"function"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L269-L277 |
tisimst/mcerp | mcerp/umath.py | tan | def tan(x):
"""
Tangent
"""
if isinstance(x, UncertainFunction):
mcpts = np.tan(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.tan(x) | python | def tan(x):
"""
Tangent
"""
if isinstance(x, UncertainFunction):
mcpts = np.tan(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.tan(x) | [
"def",
"tan",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"tan",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
"t... | Tangent | [
"Tangent"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L280-L288 |
tisimst/mcerp | mcerp/umath.py | tanh | def tanh(x):
"""
Hyperbolic tangent
"""
if isinstance(x, UncertainFunction):
mcpts = np.tanh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.tanh(x) | python | def tanh(x):
"""
Hyperbolic tangent
"""
if isinstance(x, UncertainFunction):
mcpts = np.tanh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.tanh(x) | [
"def",
"tanh",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"tanh",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | Hyperbolic tangent | [
"Hyperbolic",
"tangent"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L291-L299 |
tisimst/mcerp | mcerp/umath.py | trunc | def trunc(x):
"""
Truncate the values to the integer value without rounding
"""
if isinstance(x, UncertainFunction):
mcpts = np.trunc(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.trunc(x) | python | def trunc(x):
"""
Truncate the values to the integer value without rounding
"""
if isinstance(x, UncertainFunction):
mcpts = np.trunc(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.trunc(x) | [
"def",
"trunc",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"trunc",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | Truncate the values to the integer value without rounding | [
"Truncate",
"the",
"values",
"to",
"the",
"integer",
"value",
"without",
"rounding"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L302-L310 |
tisimst/mcerp | mcerp/lhd.py | lhd | def lhd(
dist=None,
size=None,
dims=1,
form="randomized",
iterations=100,
showcorrelations=False,
):
"""
Create a Latin-Hypercube sample design based on distributions defined in the
`scipy.stats` module
Parameters
----------
dist: array_like
frozen scipy.stat... | python | def lhd(
dist=None,
size=None,
dims=1,
form="randomized",
iterations=100,
showcorrelations=False,
):
"""
Create a Latin-Hypercube sample design based on distributions defined in the
`scipy.stats` module
Parameters
----------
dist: array_like
frozen scipy.stat... | [
"def",
"lhd",
"(",
"dist",
"=",
"None",
",",
"size",
"=",
"None",
",",
"dims",
"=",
"1",
",",
"form",
"=",
"\"randomized\"",
",",
"iterations",
"=",
"100",
",",
"showcorrelations",
"=",
"False",
",",
")",
":",
"assert",
"dims",
">",
"0",
",",
"'kwa... | Create a Latin-Hypercube sample design based on distributions defined in the
`scipy.stats` module
Parameters
----------
dist: array_like
frozen scipy.stats.rv_continuous or rv_discrete distribution objects
that are defined previous to calling LHD
size: int
integer valu... | [
"Create",
"a",
"Latin",
"-",
"Hypercube",
"sample",
"design",
"based",
"on",
"distributions",
"defined",
"in",
"the",
"scipy",
".",
"stats",
"module",
"Parameters",
"----------",
"dist",
":",
"array_like",
"frozen",
"scipy",
".",
"stats",
".",
"rv_continuous",
... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/lhd.py#L5-L286 |
tisimst/mcerp | mcerp/__init__.py | to_uncertain_func | def to_uncertain_func(x):
"""
Transforms x into an UncertainFunction-compatible object,
unless it is already an UncertainFunction (in which case x is returned
unchanged).
Raises an exception unless 'x' belongs to some specific classes of
objects that are known not to depend on UncertainFunctio... | python | def to_uncertain_func(x):
"""
Transforms x into an UncertainFunction-compatible object,
unless it is already an UncertainFunction (in which case x is returned
unchanged).
Raises an exception unless 'x' belongs to some specific classes of
objects that are known not to depend on UncertainFunctio... | [
"def",
"to_uncertain_func",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"return",
"x",
"# ! In Python 2.6+, numbers.Number could be used instead, here:",
"elif",
"isinstance",
"(",
"x",
",",
"CONSTANT_TYPES",
")",
":",
"# No... | Transforms x into an UncertainFunction-compatible object,
unless it is already an UncertainFunction (in which case x is returned
unchanged).
Raises an exception unless 'x' belongs to some specific classes of
objects that are known not to depend on UncertainFunction objects
(which then cannot be co... | [
"Transforms",
"x",
"into",
"an",
"UncertainFunction",
"-",
"compatible",
"object",
"unless",
"it",
"is",
"already",
"an",
"UncertainFunction",
"(",
"in",
"which",
"case",
"x",
"is",
"returned",
"unchanged",
")",
"."
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L31-L49 |
tisimst/mcerp | mcerp/__init__.py | Beta | def Beta(alpha, beta, low=0, high=1, tag=None):
"""
A Beta random variate
Parameters
----------
alpha : scalar
The first shape parameter
beta : scalar
The second shape parameter
Optional
--------
low : scalar
Lower bound of the distribution support (... | python | def Beta(alpha, beta, low=0, high=1, tag=None):
"""
A Beta random variate
Parameters
----------
alpha : scalar
The first shape parameter
beta : scalar
The second shape parameter
Optional
--------
low : scalar
Lower bound of the distribution support (... | [
"def",
"Beta",
"(",
"alpha",
",",
"beta",
",",
"low",
"=",
"0",
",",
"high",
"=",
"1",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"alpha",
">",
"0",
"and",
"beta",
">",
"0",
")",
",",
"'Beta \"alpha\" and \"beta\" parameters must be greater than z... | A Beta random variate
Parameters
----------
alpha : scalar
The first shape parameter
beta : scalar
The second shape parameter
Optional
--------
low : scalar
Lower bound of the distribution support (default=0)
high : scalar
Upper bound of the dist... | [
"A",
"Beta",
"random",
"variate",
"Parameters",
"----------",
"alpha",
":",
"scalar",
"The",
"first",
"shape",
"parameter",
"beta",
":",
"scalar",
"The",
"second",
"shape",
"parameter",
"Optional",
"--------",
"low",
":",
"scalar",
"Lower",
"bound",
"of",
"the... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L721-L743 |
tisimst/mcerp | mcerp/__init__.py | BetaPrime | def BetaPrime(alpha, beta, tag=None):
"""
A BetaPrime random variate
Parameters
----------
alpha : scalar
The first shape parameter
beta : scalar
The second shape parameter
"""
assert (
alpha > 0 and beta > 0
), 'BetaPrime "alpha" and "beta" paramete... | python | def BetaPrime(alpha, beta, tag=None):
"""
A BetaPrime random variate
Parameters
----------
alpha : scalar
The first shape parameter
beta : scalar
The second shape parameter
"""
assert (
alpha > 0 and beta > 0
), 'BetaPrime "alpha" and "beta" paramete... | [
"def",
"BetaPrime",
"(",
"alpha",
",",
"beta",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"alpha",
">",
"0",
"and",
"beta",
">",
"0",
")",
",",
"'BetaPrime \"alpha\" and \"beta\" parameters must be greater than zero'",
"x",
"=",
"Beta",
"(",
"alpha",
... | A BetaPrime random variate
Parameters
----------
alpha : scalar
The first shape parameter
beta : scalar
The second shape parameter | [
"A",
"BetaPrime",
"random",
"variate",
"Parameters",
"----------",
"alpha",
":",
"scalar",
"The",
"first",
"shape",
"parameter",
"beta",
":",
"scalar",
"The",
"second",
"shape",
"parameter"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L746-L762 |
tisimst/mcerp | mcerp/__init__.py | Bradford | def Bradford(q, low=0, high=1, tag=None):
"""
A Bradford random variate
Parameters
----------
q : scalar
The shape parameter
low : scalar
The lower bound of the distribution (default=0)
high : scalar
The upper bound of the distribution (default=1)
"""
ass... | python | def Bradford(q, low=0, high=1, tag=None):
"""
A Bradford random variate
Parameters
----------
q : scalar
The shape parameter
low : scalar
The lower bound of the distribution (default=0)
high : scalar
The upper bound of the distribution (default=1)
"""
ass... | [
"def",
"Bradford",
"(",
"q",
",",
"low",
"=",
"0",
",",
"high",
"=",
"1",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"q",
">",
"0",
",",
"'Bradford \"q\" parameter must be greater than zero'",
"assert",
"low",
"<",
"high",
",",
"'Bradford \"low\" parameter... | A Bradford random variate
Parameters
----------
q : scalar
The shape parameter
low : scalar
The lower bound of the distribution (default=0)
high : scalar
The upper bound of the distribution (default=1) | [
"A",
"Bradford",
"random",
"variate",
"Parameters",
"----------",
"q",
":",
"scalar",
"The",
"shape",
"parameter",
"low",
":",
"scalar",
"The",
"lower",
"bound",
"of",
"the",
"distribution",
"(",
"default",
"=",
"0",
")",
"high",
":",
"scalar",
"The",
"upp... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L765-L780 |
tisimst/mcerp | mcerp/__init__.py | Burr | def Burr(c, k, tag=None):
"""
A Burr random variate
Parameters
----------
c : scalar
The first shape parameter
k : scalar
The second shape parameter
"""
assert c > 0 and k > 0, 'Burr "c" and "k" parameters must be greater than zero'
return uv(ss.burr(c, k), ... | python | def Burr(c, k, tag=None):
"""
A Burr random variate
Parameters
----------
c : scalar
The first shape parameter
k : scalar
The second shape parameter
"""
assert c > 0 and k > 0, 'Burr "c" and "k" parameters must be greater than zero'
return uv(ss.burr(c, k), ... | [
"def",
"Burr",
"(",
"c",
",",
"k",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"c",
">",
"0",
"and",
"k",
">",
"0",
",",
"'Burr \"c\" and \"k\" parameters must be greater than zero'",
"return",
"uv",
"(",
"ss",
".",
"burr",
"(",
"c",
",",
"k",
")",
... | A Burr random variate
Parameters
----------
c : scalar
The first shape parameter
k : scalar
The second shape parameter | [
"A",
"Burr",
"random",
"variate",
"Parameters",
"----------",
"c",
":",
"scalar",
"The",
"first",
"shape",
"parameter",
"k",
":",
"scalar",
"The",
"second",
"shape",
"parameter"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L783-L796 |
tisimst/mcerp | mcerp/__init__.py | ChiSquared | def ChiSquared(k, tag=None):
"""
A Chi-Squared random variate
Parameters
----------
k : int
The degrees of freedom of the distribution (must be greater than one)
"""
assert int(k) == k and k >= 1, 'Chi-Squared "k" must be an integer greater than 0'
return uv(ss.chi2(k), tag=... | python | def ChiSquared(k, tag=None):
"""
A Chi-Squared random variate
Parameters
----------
k : int
The degrees of freedom of the distribution (must be greater than one)
"""
assert int(k) == k and k >= 1, 'Chi-Squared "k" must be an integer greater than 0'
return uv(ss.chi2(k), tag=... | [
"def",
"ChiSquared",
"(",
"k",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"int",
"(",
"k",
")",
"==",
"k",
"and",
"k",
">=",
"1",
",",
"'Chi-Squared \"k\" must be an integer greater than 0'",
"return",
"uv",
"(",
"ss",
".",
"chi2",
"(",
"k",
")",
","... | A Chi-Squared random variate
Parameters
----------
k : int
The degrees of freedom of the distribution (must be greater than one) | [
"A",
"Chi",
"-",
"Squared",
"random",
"variate",
"Parameters",
"----------",
"k",
":",
"int",
"The",
"degrees",
"of",
"freedom",
"of",
"the",
"distribution",
"(",
"must",
"be",
"greater",
"than",
"one",
")"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L799-L809 |
tisimst/mcerp | mcerp/__init__.py | Erlang | def Erlang(k, lamda, tag=None):
"""
An Erlang random variate.
This distribution is the same as a Gamma(k, theta) distribution, but
with the restriction that k must be a positive integer. This
is provided for greater compatibility with other simulation tools, but
provides no advantage over ... | python | def Erlang(k, lamda, tag=None):
"""
An Erlang random variate.
This distribution is the same as a Gamma(k, theta) distribution, but
with the restriction that k must be a positive integer. This
is provided for greater compatibility with other simulation tools, but
provides no advantage over ... | [
"def",
"Erlang",
"(",
"k",
",",
"lamda",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"int",
"(",
"k",
")",
"==",
"k",
"and",
"k",
">",
"0",
",",
"'Erlang \"k\" must be a positive integer'",
"assert",
"lamda",
">",
"0",
",",
"'Erlang \"lamda\" must be grea... | An Erlang random variate.
This distribution is the same as a Gamma(k, theta) distribution, but
with the restriction that k must be a positive integer. This
is provided for greater compatibility with other simulation tools, but
provides no advantage over the Gamma distribution in its applications.
... | [
"An",
"Erlang",
"random",
"variate",
".",
"This",
"distribution",
"is",
"the",
"same",
"as",
"a",
"Gamma",
"(",
"k",
"theta",
")",
"distribution",
"but",
"with",
"the",
"restriction",
"that",
"k",
"must",
"be",
"a",
"positive",
"integer",
".",
"This",
"i... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L832-L850 |
tisimst/mcerp | mcerp/__init__.py | Exponential | def Exponential(lamda, tag=None):
"""
An Exponential random variate
Parameters
----------
lamda : scalar
The inverse scale (as shown on Wikipedia). (FYI: mu = 1/lamda.)
"""
assert lamda > 0, 'Exponential "lamda" must be greater than zero'
return uv(ss.expon(scale=1.0 / lamda... | python | def Exponential(lamda, tag=None):
"""
An Exponential random variate
Parameters
----------
lamda : scalar
The inverse scale (as shown on Wikipedia). (FYI: mu = 1/lamda.)
"""
assert lamda > 0, 'Exponential "lamda" must be greater than zero'
return uv(ss.expon(scale=1.0 / lamda... | [
"def",
"Exponential",
"(",
"lamda",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"lamda",
">",
"0",
",",
"'Exponential \"lamda\" must be greater than zero'",
"return",
"uv",
"(",
"ss",
".",
"expon",
"(",
"scale",
"=",
"1.0",
"/",
"lamda",
")",
",",
"tag",
... | An Exponential random variate
Parameters
----------
lamda : scalar
The inverse scale (as shown on Wikipedia). (FYI: mu = 1/lamda.) | [
"An",
"Exponential",
"random",
"variate",
"Parameters",
"----------",
"lamda",
":",
"scalar",
"The",
"inverse",
"scale",
"(",
"as",
"shown",
"on",
"Wikipedia",
")",
".",
"(",
"FYI",
":",
"mu",
"=",
"1",
"/",
"lamda",
".",
")"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L853-L863 |
tisimst/mcerp | mcerp/__init__.py | ExtValueMax | def ExtValueMax(mu, sigma, tag=None):
"""
An Extreme Value Maximum random variate.
Parameters
----------
mu : scalar
The location parameter
sigma : scalar
The scale parameter (must be greater than zero)
"""
assert sigma > 0, 'ExtremeValueMax "sigma" must be greater t... | python | def ExtValueMax(mu, sigma, tag=None):
"""
An Extreme Value Maximum random variate.
Parameters
----------
mu : scalar
The location parameter
sigma : scalar
The scale parameter (must be greater than zero)
"""
assert sigma > 0, 'ExtremeValueMax "sigma" must be greater t... | [
"def",
"ExtValueMax",
"(",
"mu",
",",
"sigma",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"sigma",
">",
"0",
",",
"'ExtremeValueMax \"sigma\" must be greater than zero'",
"p",
"=",
"U",
"(",
"0",
",",
"1",
")",
".",
"_mcpts",
"[",
":",
"]",
"return",
... | An Extreme Value Maximum random variate.
Parameters
----------
mu : scalar
The location parameter
sigma : scalar
The scale parameter (must be greater than zero) | [
"An",
"Extreme",
"Value",
"Maximum",
"random",
"variate",
".",
"Parameters",
"----------",
"mu",
":",
"scalar",
"The",
"location",
"parameter",
"sigma",
":",
"scalar",
"The",
"scale",
"parameter",
"(",
"must",
"be",
"greater",
"than",
"zero",
")"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L869-L882 |
tisimst/mcerp | mcerp/__init__.py | Fisher | def Fisher(d1, d2, tag=None):
"""
An F (fisher) random variate
Parameters
----------
d1 : int
Numerator degrees of freedom
d2 : int
Denominator degrees of freedom
"""
assert (
int(d1) == d1 and d1 >= 1
), 'Fisher (F) "d1" must be an integer greater than 0... | python | def Fisher(d1, d2, tag=None):
"""
An F (fisher) random variate
Parameters
----------
d1 : int
Numerator degrees of freedom
d2 : int
Denominator degrees of freedom
"""
assert (
int(d1) == d1 and d1 >= 1
), 'Fisher (F) "d1" must be an integer greater than 0... | [
"def",
"Fisher",
"(",
"d1",
",",
"d2",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"int",
"(",
"d1",
")",
"==",
"d1",
"and",
"d1",
">=",
"1",
")",
",",
"'Fisher (F) \"d1\" must be an integer greater than 0'",
"assert",
"(",
"int",
"(",
"d2",
")",... | An F (fisher) random variate
Parameters
----------
d1 : int
Numerator degrees of freedom
d2 : int
Denominator degrees of freedom | [
"An",
"F",
"(",
"fisher",
")",
"random",
"variate",
"Parameters",
"----------",
"d1",
":",
"int",
"Numerator",
"degrees",
"of",
"freedom",
"d2",
":",
"int",
"Denominator",
"degrees",
"of",
"freedom"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L907-L924 |
tisimst/mcerp | mcerp/__init__.py | Gamma | def Gamma(k, theta, tag=None):
"""
A Gamma random variate
Parameters
----------
k : scalar
The shape parameter (must be positive and non-zero)
theta : scalar
The scale parameter (must be positive and non-zero)
"""
assert (
k > 0 and theta > 0
), 'Gamma "k... | python | def Gamma(k, theta, tag=None):
"""
A Gamma random variate
Parameters
----------
k : scalar
The shape parameter (must be positive and non-zero)
theta : scalar
The scale parameter (must be positive and non-zero)
"""
assert (
k > 0 and theta > 0
), 'Gamma "k... | [
"def",
"Gamma",
"(",
"k",
",",
"theta",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"k",
">",
"0",
"and",
"theta",
">",
"0",
")",
",",
"'Gamma \"k\" and \"theta\" parameters must be greater than zero'",
"return",
"uv",
"(",
"ss",
".",
"gamma",
"(",
... | A Gamma random variate
Parameters
----------
k : scalar
The shape parameter (must be positive and non-zero)
theta : scalar
The scale parameter (must be positive and non-zero) | [
"A",
"Gamma",
"random",
"variate",
"Parameters",
"----------",
"k",
":",
"scalar",
"The",
"shape",
"parameter",
"(",
"must",
"be",
"positive",
"and",
"non",
"-",
"zero",
")",
"theta",
":",
"scalar",
"The",
"scale",
"parameter",
"(",
"must",
"be",
"positive... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L930-L944 |
tisimst/mcerp | mcerp/__init__.py | LogNormal | def LogNormal(mu, sigma, tag=None):
"""
A Log-Normal random variate
Parameters
----------
mu : scalar
The location parameter
sigma : scalar
The scale parameter (must be positive and non-zero)
"""
assert sigma > 0, 'Log-Normal "sigma" must be positive'
return uv(s... | python | def LogNormal(mu, sigma, tag=None):
"""
A Log-Normal random variate
Parameters
----------
mu : scalar
The location parameter
sigma : scalar
The scale parameter (must be positive and non-zero)
"""
assert sigma > 0, 'Log-Normal "sigma" must be positive'
return uv(s... | [
"def",
"LogNormal",
"(",
"mu",
",",
"sigma",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"sigma",
">",
"0",
",",
"'Log-Normal \"sigma\" must be positive'",
"return",
"uv",
"(",
"ss",
".",
"lognorm",
"(",
"sigma",
",",
"loc",
"=",
"mu",
")",
",",
"tag"... | A Log-Normal random variate
Parameters
----------
mu : scalar
The location parameter
sigma : scalar
The scale parameter (must be positive and non-zero) | [
"A",
"Log",
"-",
"Normal",
"random",
"variate",
"Parameters",
"----------",
"mu",
":",
"scalar",
"The",
"location",
"parameter",
"sigma",
":",
"scalar",
"The",
"scale",
"parameter",
"(",
"must",
"be",
"positive",
"and",
"non",
"-",
"zero",
")"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L947-L959 |
tisimst/mcerp | mcerp/__init__.py | Normal | def Normal(mu, sigma, tag=None):
"""
A Normal (or Gaussian) random variate
Parameters
----------
mu : scalar
The mean value of the distribution
sigma : scalar
The standard deviation (must be positive and non-zero)
"""
assert sigma > 0, 'Normal "sigma" must be greater... | python | def Normal(mu, sigma, tag=None):
"""
A Normal (or Gaussian) random variate
Parameters
----------
mu : scalar
The mean value of the distribution
sigma : scalar
The standard deviation (must be positive and non-zero)
"""
assert sigma > 0, 'Normal "sigma" must be greater... | [
"def",
"Normal",
"(",
"mu",
",",
"sigma",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"sigma",
">",
"0",
",",
"'Normal \"sigma\" must be greater than zero'",
"return",
"uv",
"(",
"ss",
".",
"norm",
"(",
"loc",
"=",
"mu",
",",
"scale",
"=",
"sigma",
")... | A Normal (or Gaussian) random variate
Parameters
----------
mu : scalar
The mean value of the distribution
sigma : scalar
The standard deviation (must be positive and non-zero) | [
"A",
"Normal",
"(",
"or",
"Gaussian",
")",
"random",
"variate",
"Parameters",
"----------",
"mu",
":",
"scalar",
"The",
"mean",
"value",
"of",
"the",
"distribution",
"sigma",
":",
"scalar",
"The",
"standard",
"deviation",
"(",
"must",
"be",
"positive",
"and"... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L965-L977 |
tisimst/mcerp | mcerp/__init__.py | Pareto | def Pareto(q, a, tag=None):
"""
A Pareto random variate (first kind)
Parameters
----------
q : scalar
The scale parameter
a : scalar
The shape parameter (the minimum possible value)
"""
assert q > 0 and a > 0, 'Pareto "q" and "a" must be positive scalars'
p = Uni... | python | def Pareto(q, a, tag=None):
"""
A Pareto random variate (first kind)
Parameters
----------
q : scalar
The scale parameter
a : scalar
The shape parameter (the minimum possible value)
"""
assert q > 0 and a > 0, 'Pareto "q" and "a" must be positive scalars'
p = Uni... | [
"def",
"Pareto",
"(",
"q",
",",
"a",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"q",
">",
"0",
"and",
"a",
">",
"0",
",",
"'Pareto \"q\" and \"a\" must be positive scalars'",
"p",
"=",
"Uniform",
"(",
"0",
",",
"1",
",",
"tag",
")",
"return",
"a",
... | A Pareto random variate (first kind)
Parameters
----------
q : scalar
The scale parameter
a : scalar
The shape parameter (the minimum possible value) | [
"A",
"Pareto",
"random",
"variate",
"(",
"first",
"kind",
")",
"Parameters",
"----------",
"q",
":",
"scalar",
"The",
"scale",
"parameter",
"a",
":",
"scalar",
"The",
"shape",
"parameter",
"(",
"the",
"minimum",
"possible",
"value",
")"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L983-L996 |
tisimst/mcerp | mcerp/__init__.py | Pareto2 | def Pareto2(q, b, tag=None):
"""
A Pareto random variate (second kind). This form always starts at the
origin.
Parameters
----------
q : scalar
The scale parameter
b : scalar
The shape parameter
"""
assert q > 0 and b > 0, 'Pareto2 "q" and "b" must be positive sc... | python | def Pareto2(q, b, tag=None):
"""
A Pareto random variate (second kind). This form always starts at the
origin.
Parameters
----------
q : scalar
The scale parameter
b : scalar
The shape parameter
"""
assert q > 0 and b > 0, 'Pareto2 "q" and "b" must be positive sc... | [
"def",
"Pareto2",
"(",
"q",
",",
"b",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"q",
">",
"0",
"and",
"b",
">",
"0",
",",
"'Pareto2 \"q\" and \"b\" must be positive scalars'",
"return",
"Pareto",
"(",
"q",
",",
"b",
",",
"tag",
")",
"-",
"b"
] | A Pareto random variate (second kind). This form always starts at the
origin.
Parameters
----------
q : scalar
The scale parameter
b : scalar
The shape parameter | [
"A",
"Pareto",
"random",
"variate",
"(",
"second",
"kind",
")",
".",
"This",
"form",
"always",
"starts",
"at",
"the",
"origin",
".",
"Parameters",
"----------",
"q",
":",
"scalar",
"The",
"scale",
"parameter",
"b",
":",
"scalar",
"The",
"shape",
"parameter... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L999-L1012 |
tisimst/mcerp | mcerp/__init__.py | PERT | def PERT(low, peak, high, g=4.0, tag=None):
"""
A PERT random variate
Parameters
----------
low : scalar
Lower bound of the distribution support
peak : scalar
The location of the distribution's peak (low <= peak <= high)
high : scalar
Upper bound of the distribut... | python | def PERT(low, peak, high, g=4.0, tag=None):
"""
A PERT random variate
Parameters
----------
low : scalar
Lower bound of the distribution support
peak : scalar
The location of the distribution's peak (low <= peak <= high)
high : scalar
Upper bound of the distribut... | [
"def",
"PERT",
"(",
"low",
",",
"peak",
",",
"high",
",",
"g",
"=",
"4.0",
",",
"tag",
"=",
"None",
")",
":",
"a",
",",
"b",
",",
"c",
"=",
"[",
"float",
"(",
"x",
")",
"for",
"x",
"in",
"[",
"low",
",",
"peak",
",",
"high",
"]",
"]",
"... | A PERT random variate
Parameters
----------
low : scalar
Lower bound of the distribution support
peak : scalar
The location of the distribution's peak (low <= peak <= high)
high : scalar
Upper bound of the distribution support
Optional
--------
g : scala... | [
"A",
"PERT",
"random",
"variate",
"Parameters",
"----------",
"low",
":",
"scalar",
"Lower",
"bound",
"of",
"the",
"distribution",
"support",
"peak",
":",
"scalar",
"The",
"location",
"of",
"the",
"distribution",
"s",
"peak",
"(",
"low",
"<",
"=",
"peak",
... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1015-L1046 |
tisimst/mcerp | mcerp/__init__.py | StudentT | def StudentT(v, tag=None):
"""
A Student-T random variate
Parameters
----------
v : int
The degrees of freedom of the distribution (must be greater than one)
"""
assert int(v) == v and v >= 1, 'Student-T "v" must be an integer greater than 0'
return uv(ss.t(v), tag=tag) | python | def StudentT(v, tag=None):
"""
A Student-T random variate
Parameters
----------
v : int
The degrees of freedom of the distribution (must be greater than one)
"""
assert int(v) == v and v >= 1, 'Student-T "v" must be an integer greater than 0'
return uv(ss.t(v), tag=tag) | [
"def",
"StudentT",
"(",
"v",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"int",
"(",
"v",
")",
"==",
"v",
"and",
"v",
">=",
"1",
",",
"'Student-T \"v\" must be an integer greater than 0'",
"return",
"uv",
"(",
"ss",
".",
"t",
"(",
"v",
")",
",",
"ta... | A Student-T random variate
Parameters
----------
v : int
The degrees of freedom of the distribution (must be greater than one) | [
"A",
"Student",
"-",
"T",
"random",
"variate",
"Parameters",
"----------",
"v",
":",
"int",
"The",
"degrees",
"of",
"freedom",
"of",
"the",
"distribution",
"(",
"must",
"be",
"greater",
"than",
"one",
")"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1049-L1059 |
tisimst/mcerp | mcerp/__init__.py | Triangular | def Triangular(low, peak, high, tag=None):
"""
A triangular random variate
Parameters
----------
low : scalar
Lower bound of the distribution support
peak : scalar
The location of the triangle's peak (low <= peak <= high)
high : scalar
Upper bound of the distribu... | python | def Triangular(low, peak, high, tag=None):
"""
A triangular random variate
Parameters
----------
low : scalar
Lower bound of the distribution support
peak : scalar
The location of the triangle's peak (low <= peak <= high)
high : scalar
Upper bound of the distribu... | [
"def",
"Triangular",
"(",
"low",
",",
"peak",
",",
"high",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"low",
"<=",
"peak",
"<=",
"high",
",",
"'Triangular \"peak\" must lie between \"low\" and \"high\"'",
"low",
",",
"peak",
",",
"high",
"=",
"[",
"float",... | A triangular random variate
Parameters
----------
low : scalar
Lower bound of the distribution support
peak : scalar
The location of the triangle's peak (low <= peak <= high)
high : scalar
Upper bound of the distribution support | [
"A",
"triangular",
"random",
"variate",
"Parameters",
"----------",
"low",
":",
"scalar",
"Lower",
"bound",
"of",
"the",
"distribution",
"support",
"peak",
":",
"scalar",
"The",
"location",
"of",
"the",
"triangle",
"s",
"peak",
"(",
"low",
"<",
"=",
"peak",
... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1065-L1083 |
tisimst/mcerp | mcerp/__init__.py | Uniform | def Uniform(low, high, tag=None):
"""
A Uniform random variate
Parameters
----------
low : scalar
Lower bound of the distribution support.
high : scalar
Upper bound of the distribution support.
"""
assert low < high, 'Uniform "low" must be less than "high"'
retur... | python | def Uniform(low, high, tag=None):
"""
A Uniform random variate
Parameters
----------
low : scalar
Lower bound of the distribution support.
high : scalar
Upper bound of the distribution support.
"""
assert low < high, 'Uniform "low" must be less than "high"'
retur... | [
"def",
"Uniform",
"(",
"low",
",",
"high",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"low",
"<",
"high",
",",
"'Uniform \"low\" must be less than \"high\"'",
"return",
"uv",
"(",
"ss",
".",
"uniform",
"(",
"loc",
"=",
"low",
",",
"scale",
"=",
"high",... | A Uniform random variate
Parameters
----------
low : scalar
Lower bound of the distribution support.
high : scalar
Upper bound of the distribution support. | [
"A",
"Uniform",
"random",
"variate",
"Parameters",
"----------",
"low",
":",
"scalar",
"Lower",
"bound",
"of",
"the",
"distribution",
"support",
".",
"high",
":",
"scalar",
"Upper",
"bound",
"of",
"the",
"distribution",
"support",
"."
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1089-L1101 |
tisimst/mcerp | mcerp/__init__.py | Weibull | def Weibull(lamda, k, tag=None):
"""
A Weibull random variate
Parameters
----------
lamda : scalar
The scale parameter
k : scalar
The shape parameter
"""
assert (
lamda > 0 and k > 0
), 'Weibull "lamda" and "k" parameters must be greater than zero'
re... | python | def Weibull(lamda, k, tag=None):
"""
A Weibull random variate
Parameters
----------
lamda : scalar
The scale parameter
k : scalar
The shape parameter
"""
assert (
lamda > 0 and k > 0
), 'Weibull "lamda" and "k" parameters must be greater than zero'
re... | [
"def",
"Weibull",
"(",
"lamda",
",",
"k",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"lamda",
">",
"0",
"and",
"k",
">",
"0",
")",
",",
"'Weibull \"lamda\" and \"k\" parameters must be greater than zero'",
"return",
"uv",
"(",
"ss",
".",
"exponweib",
... | A Weibull random variate
Parameters
----------
lamda : scalar
The scale parameter
k : scalar
The shape parameter | [
"A",
"Weibull",
"random",
"variate",
"Parameters",
"----------",
"lamda",
":",
"scalar",
"The",
"scale",
"parameter",
"k",
":",
"scalar",
"The",
"shape",
"parameter"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1107-L1121 |
tisimst/mcerp | mcerp/__init__.py | Bernoulli | def Bernoulli(p, tag=None):
"""
A Bernoulli random variate
Parameters
----------
p : scalar
The probability of success
"""
assert (
0 < p < 1
), 'Bernoulli probability "p" must be between zero and one, non-inclusive'
return uv(ss.bernoulli(p), tag=tag) | python | def Bernoulli(p, tag=None):
"""
A Bernoulli random variate
Parameters
----------
p : scalar
The probability of success
"""
assert (
0 < p < 1
), 'Bernoulli probability "p" must be between zero and one, non-inclusive'
return uv(ss.bernoulli(p), tag=tag) | [
"def",
"Bernoulli",
"(",
"p",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"0",
"<",
"p",
"<",
"1",
")",
",",
"'Bernoulli probability \"p\" must be between zero and one, non-inclusive'",
"return",
"uv",
"(",
"ss",
".",
"bernoulli",
"(",
"p",
")",
",",
... | A Bernoulli random variate
Parameters
----------
p : scalar
The probability of success | [
"A",
"Bernoulli",
"random",
"variate",
"Parameters",
"----------",
"p",
":",
"scalar",
"The",
"probability",
"of",
"success"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1132-L1144 |
tisimst/mcerp | mcerp/__init__.py | Binomial | def Binomial(n, p, tag=None):
"""
A Binomial random variate
Parameters
----------
n : int
The number of trials
p : scalar
The probability of success
"""
assert (
int(n) == n and n > 0
), 'Binomial number of trials "n" must be an integer greater than zero'... | python | def Binomial(n, p, tag=None):
"""
A Binomial random variate
Parameters
----------
n : int
The number of trials
p : scalar
The probability of success
"""
assert (
int(n) == n and n > 0
), 'Binomial number of trials "n" must be an integer greater than zero'... | [
"def",
"Binomial",
"(",
"n",
",",
"p",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"int",
"(",
"n",
")",
"==",
"n",
"and",
"n",
">",
"0",
")",
",",
"'Binomial number of trials \"n\" must be an integer greater than zero'",
"assert",
"(",
"0",
"<",
"... | A Binomial random variate
Parameters
----------
n : int
The number of trials
p : scalar
The probability of success | [
"A",
"Binomial",
"random",
"variate",
"Parameters",
"----------",
"n",
":",
"int",
"The",
"number",
"of",
"trials",
"p",
":",
"scalar",
"The",
"probability",
"of",
"success"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1150-L1167 |
tisimst/mcerp | mcerp/__init__.py | Geometric | def Geometric(p, tag=None):
"""
A Geometric random variate
Parameters
----------
p : scalar
The probability of success
"""
assert (
0 < p < 1
), 'Geometric probability "p" must be between zero and one, non-inclusive'
return uv(ss.geom(p), tag=tag) | python | def Geometric(p, tag=None):
"""
A Geometric random variate
Parameters
----------
p : scalar
The probability of success
"""
assert (
0 < p < 1
), 'Geometric probability "p" must be between zero and one, non-inclusive'
return uv(ss.geom(p), tag=tag) | [
"def",
"Geometric",
"(",
"p",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"0",
"<",
"p",
"<",
"1",
")",
",",
"'Geometric probability \"p\" must be between zero and one, non-inclusive'",
"return",
"uv",
"(",
"ss",
".",
"geom",
"(",
"p",
")",
",",
"tag... | A Geometric random variate
Parameters
----------
p : scalar
The probability of success | [
"A",
"Geometric",
"random",
"variate",
"Parameters",
"----------",
"p",
":",
"scalar",
"The",
"probability",
"of",
"success"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1173-L1185 |
tisimst/mcerp | mcerp/__init__.py | Hypergeometric | def Hypergeometric(N, n, K, tag=None):
"""
A Hypergeometric random variate
Parameters
----------
N : int
The total population size
n : int
The number of individuals of interest in the population
K : int
The number of individuals that will be chosen from the popul... | python | def Hypergeometric(N, n, K, tag=None):
"""
A Hypergeometric random variate
Parameters
----------
N : int
The total population size
n : int
The number of individuals of interest in the population
K : int
The number of individuals that will be chosen from the popul... | [
"def",
"Hypergeometric",
"(",
"N",
",",
"n",
",",
"K",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"(",
"int",
"(",
"N",
")",
"==",
"N",
"and",
"N",
">",
"0",
")",
",",
"'Hypergeometric total population size \"N\" must be an integer greater than zero.'",
"a... | A Hypergeometric random variate
Parameters
----------
N : int
The total population size
n : int
The number of individuals of interest in the population
K : int
The number of individuals that will be chosen from the population
Example
-------
(Taken f... | [
"A",
"Hypergeometric",
"random",
"variate",
"Parameters",
"----------",
"N",
":",
"int",
"The",
"total",
"population",
"size",
"n",
":",
"int",
"The",
"number",
"of",
"individuals",
"of",
"interest",
"in",
"the",
"population",
"K",
":",
"int",
"The",
"number... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1191-L1234 |
tisimst/mcerp | mcerp/__init__.py | Poisson | def Poisson(lamda, tag=None):
"""
A Poisson random variate
Parameters
----------
lamda : scalar
The rate of an occurance within a specified interval of time or space.
"""
assert lamda > 0, 'Poisson "lamda" must be greater than zero.'
return uv(ss.poisson(lamda), tag=tag) | python | def Poisson(lamda, tag=None):
"""
A Poisson random variate
Parameters
----------
lamda : scalar
The rate of an occurance within a specified interval of time or space.
"""
assert lamda > 0, 'Poisson "lamda" must be greater than zero.'
return uv(ss.poisson(lamda), tag=tag) | [
"def",
"Poisson",
"(",
"lamda",
",",
"tag",
"=",
"None",
")",
":",
"assert",
"lamda",
">",
"0",
",",
"'Poisson \"lamda\" must be greater than zero.'",
"return",
"uv",
"(",
"ss",
".",
"poisson",
"(",
"lamda",
")",
",",
"tag",
"=",
"tag",
")"
] | A Poisson random variate
Parameters
----------
lamda : scalar
The rate of an occurance within a specified interval of time or space. | [
"A",
"Poisson",
"random",
"variate",
"Parameters",
"----------",
"lamda",
":",
"scalar",
"The",
"rate",
"of",
"an",
"occurance",
"within",
"a",
"specified",
"interval",
"of",
"time",
"or",
"space",
"."
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1240-L1250 |
tisimst/mcerp | mcerp/__init__.py | covariance_matrix | def covariance_matrix(nums_with_uncert):
"""
Calculate the covariance matrix of uncertain variables, oriented by the
order of the inputs
Parameters
----------
nums_with_uncert : array-like
A list of variables that have an associated uncertainty
Returns
-------
cov_m... | python | def covariance_matrix(nums_with_uncert):
"""
Calculate the covariance matrix of uncertain variables, oriented by the
order of the inputs
Parameters
----------
nums_with_uncert : array-like
A list of variables that have an associated uncertainty
Returns
-------
cov_m... | [
"def",
"covariance_matrix",
"(",
"nums_with_uncert",
")",
":",
"ufuncs",
"=",
"list",
"(",
"map",
"(",
"to_uncertain_func",
",",
"nums_with_uncert",
")",
")",
"cov_matrix",
"=",
"[",
"]",
"for",
"(",
"i1",
",",
"expr1",
")",
"in",
"enumerate",
"(",
"ufuncs... | Calculate the covariance matrix of uncertain variables, oriented by the
order of the inputs
Parameters
----------
nums_with_uncert : array-like
A list of variables that have an associated uncertainty
Returns
-------
cov_matrix : 2d-array-like
A nested list containin... | [
"Calculate",
"the",
"covariance",
"matrix",
"of",
"uncertain",
"variables",
"oriented",
"by",
"the",
"order",
"of",
"the",
"inputs",
"Parameters",
"----------",
"nums_with_uncert",
":",
"array",
"-",
"like",
"A",
"list",
"of",
"variables",
"that",
"have",
"an",
... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1261-L1303 |
tisimst/mcerp | mcerp/__init__.py | correlation_matrix | def correlation_matrix(nums_with_uncert):
"""
Calculate the correlation matrix of uncertain variables, oriented by the
order of the inputs
Parameters
----------
nums_with_uncert : array-like
A list of variables that have an associated uncertainty
Returns
-------
cor... | python | def correlation_matrix(nums_with_uncert):
"""
Calculate the correlation matrix of uncertain variables, oriented by the
order of the inputs
Parameters
----------
nums_with_uncert : array-like
A list of variables that have an associated uncertainty
Returns
-------
cor... | [
"def",
"correlation_matrix",
"(",
"nums_with_uncert",
")",
":",
"ufuncs",
"=",
"list",
"(",
"map",
"(",
"to_uncertain_func",
",",
"nums_with_uncert",
")",
")",
"data",
"=",
"np",
".",
"vstack",
"(",
"[",
"ufunc",
".",
"_mcpts",
"for",
"ufunc",
"in",
"ufunc... | Calculate the correlation matrix of uncertain variables, oriented by the
order of the inputs
Parameters
----------
nums_with_uncert : array-like
A list of variables that have an associated uncertainty
Returns
-------
corr_matrix : 2d-array-like
A nested list contain... | [
"Calculate",
"the",
"correlation",
"matrix",
"of",
"uncertain",
"variables",
"oriented",
"by",
"the",
"order",
"of",
"the",
"inputs",
"Parameters",
"----------",
"nums_with_uncert",
":",
"array",
"-",
"like",
"A",
"list",
"of",
"variables",
"that",
"have",
"an",... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1306-L1335 |
tisimst/mcerp | mcerp/__init__.py | UncertainFunction.var | def var(self):
"""
Variance value as a result of an uncertainty calculation
"""
mn = self.mean
vr = np.mean((self._mcpts - mn) ** 2)
return vr | python | def var(self):
"""
Variance value as a result of an uncertainty calculation
"""
mn = self.mean
vr = np.mean((self._mcpts - mn) ** 2)
return vr | [
"def",
"var",
"(",
"self",
")",
":",
"mn",
"=",
"self",
".",
"mean",
"vr",
"=",
"np",
".",
"mean",
"(",
"(",
"self",
".",
"_mcpts",
"-",
"mn",
")",
"**",
"2",
")",
"return",
"vr"
] | Variance value as a result of an uncertainty calculation | [
"Variance",
"value",
"as",
"a",
"result",
"of",
"an",
"uncertainty",
"calculation"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L74-L80 |
tisimst/mcerp | mcerp/__init__.py | UncertainFunction.skew | def skew(self):
r"""
Skewness coefficient value as a result of an uncertainty calculation,
defined as::
_____ m3
\/beta1 = ------
std**3
where m3 is the third central moment and std is the standard deviation
... | python | def skew(self):
r"""
Skewness coefficient value as a result of an uncertainty calculation,
defined as::
_____ m3
\/beta1 = ------
std**3
where m3 is the third central moment and std is the standard deviation
... | [
"def",
"skew",
"(",
"self",
")",
":",
"mn",
"=",
"self",
".",
"mean",
"sd",
"=",
"self",
".",
"std",
"sk",
"=",
"0.0",
"if",
"abs",
"(",
"sd",
")",
"<=",
"1e-8",
"else",
"np",
".",
"mean",
"(",
"(",
"self",
".",
"_mcpts",
"-",
"mn",
")",
"*... | r"""
Skewness coefficient value as a result of an uncertainty calculation,
defined as::
_____ m3
\/beta1 = ------
std**3
where m3 is the third central moment and std is the standard deviation | [
"r",
"Skewness",
"coefficient",
"value",
"as",
"a",
"result",
"of",
"an",
"uncertainty",
"calculation",
"defined",
"as",
"::",
"_____",
"m3",
"\\",
"/",
"beta1",
"=",
"------",
"std",
"**",
"3",
"where",
"m3",
"is",
"the",
"third",
"central",
"moment",
"... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L95-L109 |
tisimst/mcerp | mcerp/__init__.py | UncertainFunction.kurt | def kurt(self):
"""
Kurtosis coefficient value as a result of an uncertainty calculation,
defined as::
m4
beta2 = ------
std**4
where m4 is the fourth central moment and std is the standard deviation
"""
... | python | def kurt(self):
"""
Kurtosis coefficient value as a result of an uncertainty calculation,
defined as::
m4
beta2 = ------
std**4
where m4 is the fourth central moment and std is the standard deviation
"""
... | [
"def",
"kurt",
"(",
"self",
")",
":",
"mn",
"=",
"self",
".",
"mean",
"sd",
"=",
"self",
".",
"std",
"kt",
"=",
"0.0",
"if",
"abs",
"(",
"sd",
")",
"<=",
"1e-8",
"else",
"np",
".",
"mean",
"(",
"(",
"self",
".",
"_mcpts",
"-",
"mn",
")",
"*... | Kurtosis coefficient value as a result of an uncertainty calculation,
defined as::
m4
beta2 = ------
std**4
where m4 is the fourth central moment and std is the standard deviation | [
"Kurtosis",
"coefficient",
"value",
"as",
"a",
"result",
"of",
"an",
"uncertainty",
"calculation",
"defined",
"as",
"::",
"m4",
"beta2",
"=",
"------",
"std",
"**",
"4"
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L112-L126 |
tisimst/mcerp | mcerp/__init__.py | UncertainFunction.stats | def stats(self):
"""
The first four standard moments of a distribution: mean, variance, and
standardized skewness and kurtosis coefficients.
"""
mn = self.mean
vr = self.var
sk = self.skew
kt = self.kurt
return [mn, vr, sk, kt] | python | def stats(self):
"""
The first four standard moments of a distribution: mean, variance, and
standardized skewness and kurtosis coefficients.
"""
mn = self.mean
vr = self.var
sk = self.skew
kt = self.kurt
return [mn, vr, sk, kt] | [
"def",
"stats",
"(",
"self",
")",
":",
"mn",
"=",
"self",
".",
"mean",
"vr",
"=",
"self",
".",
"var",
"sk",
"=",
"self",
".",
"skew",
"kt",
"=",
"self",
".",
"kurt",
"return",
"[",
"mn",
",",
"vr",
",",
"sk",
",",
"kt",
"]"
] | The first four standard moments of a distribution: mean, variance, and
standardized skewness and kurtosis coefficients. | [
"The",
"first",
"four",
"standard",
"moments",
"of",
"a",
"distribution",
":",
"mean",
"variance",
"and",
"standardized",
"skewness",
"and",
"kurtosis",
"coefficients",
"."
] | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L129-L138 |
tisimst/mcerp | mcerp/__init__.py | UncertainFunction.percentile | def percentile(self, val):
"""
Get the distribution value at a given percentile or set of percentiles.
This follows the NIST method for calculating percentiles.
Parameters
----------
val : scalar or array
Either a single value or an array of values be... | python | def percentile(self, val):
"""
Get the distribution value at a given percentile or set of percentiles.
This follows the NIST method for calculating percentiles.
Parameters
----------
val : scalar or array
Either a single value or an array of values be... | [
"def",
"percentile",
"(",
"self",
",",
"val",
")",
":",
"try",
":",
"# test to see if an input is given as an array",
"out",
"=",
"[",
"self",
".",
"percentile",
"(",
"vi",
")",
"for",
"vi",
"in",
"val",
"]",
"except",
"(",
"ValueError",
",",
"TypeError",
... | Get the distribution value at a given percentile or set of percentiles.
This follows the NIST method for calculating percentiles.
Parameters
----------
val : scalar or array
Either a single value or an array of values between 0 and 1.
Returns
... | [
"Get",
"the",
"distribution",
"value",
"at",
"a",
"given",
"percentile",
"or",
"set",
"of",
"percentiles",
".",
"This",
"follows",
"the",
"NIST",
"method",
"for",
"calculating",
"percentiles",
".",
"Parameters",
"----------",
"val",
":",
"scalar",
"or",
"array... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L140-L172 |
tisimst/mcerp | mcerp/__init__.py | UncertainFunction.describe | def describe(self, name=None):
"""
Cleanly show what the four displayed distribution moments are:
- Mean
- Variance
- Standardized Skewness Coefficient
- Standardized Kurtosis Coefficient
For a standard Normal distribution, these are [0, 1... | python | def describe(self, name=None):
"""
Cleanly show what the four displayed distribution moments are:
- Mean
- Variance
- Standardized Skewness Coefficient
- Standardized Kurtosis Coefficient
For a standard Normal distribution, these are [0, 1... | [
"def",
"describe",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"mn",
",",
"vr",
",",
"sk",
",",
"kt",
"=",
"self",
".",
"stats",
"if",
"name",
"is",
"not",
"None",
":",
"s",
"=",
"\"MCERP Uncertain Value (\"",
"+",
"name",
"+",
"\"):\\n\"",
"e... | Cleanly show what the four displayed distribution moments are:
- Mean
- Variance
- Standardized Skewness Coefficient
- Standardized Kurtosis Coefficient
For a standard Normal distribution, these are [0, 1, 0, 3].
If the object has an asso... | [
"Cleanly",
"show",
"what",
"the",
"four",
"displayed",
"distribution",
"moments",
"are",
":",
"-",
"Mean",
"-",
"Variance",
"-",
"Standardized",
"Skewness",
"Coefficient",
"-",
"Standardized",
"Kurtosis",
"Coefficient",
"For",
"a",
"standard",
"Normal",
"distribut... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L191-L239 |
tisimst/mcerp | mcerp/__init__.py | UncertainFunction.plot | def plot(self, hist=False, show=False, **kwargs):
"""
Plot the distribution of the UncertainFunction. By default, the
distribution is shown with a kernel density estimate (kde).
Optional
--------
hist : bool
If true, a density histogram is displayed (... | python | def plot(self, hist=False, show=False, **kwargs):
"""
Plot the distribution of the UncertainFunction. By default, the
distribution is shown with a kernel density estimate (kde).
Optional
--------
hist : bool
If true, a density histogram is displayed (... | [
"def",
"plot",
"(",
"self",
",",
"hist",
"=",
"False",
",",
"show",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"vals",
"=",
"self",
".",
"_mcpts",
"low",
"=",
"min",
"(",
"vals",
")",
"hig... | Plot the distribution of the UncertainFunction. By default, the
distribution is shown with a kernel density estimate (kde).
Optional
--------
hist : bool
If true, a density histogram is displayed (histtype='stepfilled')
show : bool
If ``True``, th... | [
"Plot",
"the",
"distribution",
"of",
"the",
"UncertainFunction",
".",
"By",
"default",
"the",
"distribution",
"is",
"shown",
"with",
"a",
"kernel",
"density",
"estimate",
"(",
"kde",
")",
".",
"Optional",
"--------",
"hist",
":",
"bool",
"If",
"true",
"a",
... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L241-L281 |
tisimst/mcerp | mcerp/__init__.py | UncertainVariable.plot | def plot(self, hist=False, show=False, **kwargs):
"""
Plot the distribution of the UncertainVariable. Continuous
distributions are plotted with a line plot and discrete distributions
are plotted with discrete circles.
Optional
--------
hist : bool
... | python | def plot(self, hist=False, show=False, **kwargs):
"""
Plot the distribution of the UncertainVariable. Continuous
distributions are plotted with a line plot and discrete distributions
are plotted with discrete circles.
Optional
--------
hist : bool
... | [
"def",
"plot",
"(",
"self",
",",
"hist",
"=",
"False",
",",
"show",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"if",
"hist",
":",
"vals",
"=",
"self",
".",
"_mcpts",
"low",
"=",
"vals",
".... | Plot the distribution of the UncertainVariable. Continuous
distributions are plotted with a line plot and discrete distributions
are plotted with discrete circles.
Optional
--------
hist : bool
If true, a histogram is displayed
show : bool
... | [
"Plot",
"the",
"distribution",
"of",
"the",
"UncertainVariable",
".",
"Continuous",
"distributions",
"are",
"plotted",
"with",
"a",
"line",
"plot",
"and",
"discrete",
"distributions",
"are",
"plotted",
"with",
"discrete",
"circles",
".",
"Optional",
"--------",
"h... | train | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L652-L698 |
shoeffner/cvloop | cvloop/functions.py | DrawHat.load_hat | def load_hat(self, path): # pylint: disable=no-self-use
"""Loads the hat from a picture at path.
Args:
path: The path to load from
Returns:
The hat data.
"""
hat = cv2.imread(path, cv2.IMREAD_UNCHANGED)
if hat is None:
raise ValueErr... | python | def load_hat(self, path): # pylint: disable=no-self-use
"""Loads the hat from a picture at path.
Args:
path: The path to load from
Returns:
The hat data.
"""
hat = cv2.imread(path, cv2.IMREAD_UNCHANGED)
if hat is None:
raise ValueErr... | [
"def",
"load_hat",
"(",
"self",
",",
"path",
")",
":",
"# pylint: disable=no-self-use",
"hat",
"=",
"cv2",
".",
"imread",
"(",
"path",
",",
"cv2",
".",
"IMREAD_UNCHANGED",
")",
"if",
"hat",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'No hat image found ... | Loads the hat from a picture at path.
Args:
path: The path to load from
Returns:
The hat data. | [
"Loads",
"the",
"hat",
"from",
"a",
"picture",
"at",
"path",
"."
] | train | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/functions.py#L173-L186 |
shoeffner/cvloop | cvloop/functions.py | DrawHat.find_faces | def find_faces(self, image, draw_box=False):
"""Uses a haarcascade to detect faces inside an image.
Args:
image: The image.
draw_box: If True, the image will be marked with a rectangle.
Return:
The faces as returned by OpenCV's detectMultiScale method for
... | python | def find_faces(self, image, draw_box=False):
"""Uses a haarcascade to detect faces inside an image.
Args:
image: The image.
draw_box: If True, the image will be marked with a rectangle.
Return:
The faces as returned by OpenCV's detectMultiScale method for
... | [
"def",
"find_faces",
"(",
"self",
",",
"image",
",",
"draw_box",
"=",
"False",
")",
":",
"frame_gray",
"=",
"cv2",
".",
"cvtColor",
"(",
"image",
",",
"cv2",
".",
"COLOR_RGB2GRAY",
")",
"faces",
"=",
"self",
".",
"cascade",
".",
"detectMultiScale",
"(",
... | Uses a haarcascade to detect faces inside an image.
Args:
image: The image.
draw_box: If True, the image will be marked with a rectangle.
Return:
The faces as returned by OpenCV's detectMultiScale method for
cascades. | [
"Uses",
"a",
"haarcascade",
"to",
"detect",
"faces",
"inside",
"an",
"image",
"."
] | train | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/functions.py#L188-L211 |
uber-archive/h1-python | h1/client.py | HackerOneClient.find_resources | def find_resources(self, rsrc_type, sort=None, yield_pages=False, **kwargs):
"""Find instances of `rsrc_type` that match the filter in `**kwargs`"""
return rsrc_type.find(self, sort=sort, yield_pages=yield_pages, **kwargs) | python | def find_resources(self, rsrc_type, sort=None, yield_pages=False, **kwargs):
"""Find instances of `rsrc_type` that match the filter in `**kwargs`"""
return rsrc_type.find(self, sort=sort, yield_pages=yield_pages, **kwargs) | [
"def",
"find_resources",
"(",
"self",
",",
"rsrc_type",
",",
"sort",
"=",
"None",
",",
"yield_pages",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"rsrc_type",
".",
"find",
"(",
"self",
",",
"sort",
"=",
"sort",
",",
"yield_pages",
"=",
... | Find instances of `rsrc_type` that match the filter in `**kwargs` | [
"Find",
"instances",
"of",
"rsrc_type",
"that",
"match",
"the",
"filter",
"in",
"**",
"kwargs"
] | train | https://github.com/uber-archive/h1-python/blob/c91aec6a26887e453106af39e96ec6d5c7b00c9d/h1/client.py#L111-L113 |
edelooff/sqlalchemy-json | sqlalchemy_json/track.py | TrackedObject.changed | def changed(self, message=None, *args):
"""Marks the object as changed.
If a `parent` attribute is set, the `changed()` method on the parent
will be called, propagating the change notification up the chain.
The message (if provided) will be debug logged.
"""
if message ... | python | def changed(self, message=None, *args):
"""Marks the object as changed.
If a `parent` attribute is set, the `changed()` method on the parent
will be called, propagating the change notification up the chain.
The message (if provided) will be debug logged.
"""
if message ... | [
"def",
"changed",
"(",
"self",
",",
"message",
"=",
"None",
",",
"*",
"args",
")",
":",
"if",
"message",
"is",
"not",
"None",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'%s: %s'",
",",
"self",
".",
"_repr",
"(",
")",
",",
"message",
"%",
"ar... | Marks the object as changed.
If a `parent` attribute is set, the `changed()` method on the parent
will be called, propagating the change notification up the chain.
The message (if provided) will be debug logged. | [
"Marks",
"the",
"object",
"as",
"changed",
"."
] | train | https://github.com/edelooff/sqlalchemy-json/blob/4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc/sqlalchemy_json/track.py#L25-L39 |
edelooff/sqlalchemy-json | sqlalchemy_json/track.py | TrackedObject.register | def register(cls, origin_type):
"""Decorator for mutation tracker registration.
The provided `origin_type` is mapped to the decorated class such that
future calls to `convert()` will convert the object of `origin_type`
to an instance of the decorated class.
"""
def decor... | python | def register(cls, origin_type):
"""Decorator for mutation tracker registration.
The provided `origin_type` is mapped to the decorated class such that
future calls to `convert()` will convert the object of `origin_type`
to an instance of the decorated class.
"""
def decor... | [
"def",
"register",
"(",
"cls",
",",
"origin_type",
")",
":",
"def",
"decorator",
"(",
"tracked_type",
")",
":",
"\"\"\"Adds the decorated class to the `_type_mapping` dictionary.\"\"\"",
"cls",
".",
"_type_mapping",
"[",
"origin_type",
"]",
"=",
"tracked_type",
"return"... | Decorator for mutation tracker registration.
The provided `origin_type` is mapped to the decorated class such that
future calls to `convert()` will convert the object of `origin_type`
to an instance of the decorated class. | [
"Decorator",
"for",
"mutation",
"tracker",
"registration",
"."
] | train | https://github.com/edelooff/sqlalchemy-json/blob/4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc/sqlalchemy_json/track.py#L42-L53 |
edelooff/sqlalchemy-json | sqlalchemy_json/track.py | TrackedObject.convert | def convert(cls, obj, parent):
"""Converts objects to registered tracked types
This checks the type of the given object against the registered tracked
types. When a match is found, the given object will be converted to the
tracked type, its parent set to the provided parent, and returne... | python | def convert(cls, obj, parent):
"""Converts objects to registered tracked types
This checks the type of the given object against the registered tracked
types. When a match is found, the given object will be converted to the
tracked type, its parent set to the provided parent, and returne... | [
"def",
"convert",
"(",
"cls",
",",
"obj",
",",
"parent",
")",
":",
"replacement_type",
"=",
"cls",
".",
"_type_mapping",
".",
"get",
"(",
"type",
"(",
"obj",
")",
")",
"if",
"replacement_type",
"is",
"not",
"None",
":",
"new",
"=",
"replacement_type",
... | Converts objects to registered tracked types
This checks the type of the given object against the registered tracked
types. When a match is found, the given object will be converted to the
tracked type, its parent set to the provided parent, and returned.
If its type does not occur in ... | [
"Converts",
"objects",
"to",
"registered",
"tracked",
"types"
] | train | https://github.com/edelooff/sqlalchemy-json/blob/4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc/sqlalchemy_json/track.py#L56-L71 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.