repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
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",
":"
] | a182e73a750f03e906d9b25842d556db8d2fd54f | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L155-L172 | train |
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"
] | a182e73a750f03e906d9b25842d556db8d2fd54f | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L187-L191 | train |
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"
] | a182e73a750f03e906d9b25842d556db8d2fd54f | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L193-L202 | train |
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"
] | a182e73a750f03e906d9b25842d556db8d2fd54f | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L204-L215 | train |
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"
] | a182e73a750f03e906d9b25842d556db8d2fd54f | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L231-L253 | train |
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"
] | a182e73a750f03e906d9b25842d556db8d2fd54f | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L255-L261 | train |
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"
] | a182e73a750f03e906d9b25842d556db8d2fd54f | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L263-L269 | train |
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",
"."
] | a182e73a750f03e906d9b25842d556db8d2fd54f | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L298-L306 | train |
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",
"."
] | a182e73a750f03e906d9b25842d556db8d2fd54f | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L308-L314 | train |
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",
"/... | a182e73a750f03e906d9b25842d556db8d2fd54f | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L316-L324 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L18-L26 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L29-L37 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L40-L48 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L51-L59 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L62-L70 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L73-L81 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L84-L92 | train |
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",
")"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L95-L103 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L106-L114 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L117-L125 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L128-L136 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L139-L147 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L150-L158 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L161-L169 | train |
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",
")"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L172-L180 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L183-L193 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L203-L211 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L214-L222 | train |
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",
")"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L225-L233 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L236-L244 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L247-L255 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L258-L266 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L269-L277 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L280-L288 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L291-L299 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L302-L310 | train |
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",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/lhd.py#L5-L286 | train |
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",
")",
"."
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L31-L49 | train |
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... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L721-L743 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L746-L762 | train |
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... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L765-L780 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L783-L796 | train |
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",
")"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L799-L809 | train |
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... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L832-L850 | train |
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",
".",
")"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L853-L863 | train |
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",
")"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L869-L882 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L907-L924 | train |
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... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L930-L944 | train |
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",
")"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L947-L959 | train |
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"... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L965-L977 | train |
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",
")"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L983-L996 | train |
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... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L999-L1012 | train |
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",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1015-L1046 | train |
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",
")"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1049-L1059 | train |
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",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1065-L1083 | train |
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",
"."
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1089-L1101 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1107-L1121 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1132-L1144 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1150-L1167 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1173-L1185 | train |
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... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1191-L1234 | train |
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",
"."
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1240-L1250 | train |
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",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1261-L1303 | train |
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",... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L1306-L1335 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L74-L80 | train |
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",
"... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L95-L109 | train |
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"
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L112-L126 | train |
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",
"."
] | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L129-L138 | train |
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... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L140-L172 | train |
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... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L191-L239 | train |
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",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L241-L281 | train |
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... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L652-L698 | train |
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",
"."
] | 3ddd311e9b679d16c8fd36779931380374de343c | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/functions.py#L173-L186 | train |
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",
"."
] | 3ddd311e9b679d16c8fd36779931380374de343c | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/functions.py#L188-L211 | train |
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"
] | c91aec6a26887e453106af39e96ec6d5c7b00c9d | https://github.com/uber-archive/h1-python/blob/c91aec6a26887e453106af39e96ec6d5c7b00c9d/h1/client.py#L111-L113 | train |
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",
"."
] | 4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc | https://github.com/edelooff/sqlalchemy-json/blob/4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc/sqlalchemy_json/track.py#L25-L39 | train |
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",
"."
] | 4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc | https://github.com/edelooff/sqlalchemy-json/blob/4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc/sqlalchemy_json/track.py#L42-L53 | train |
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"
] | 4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc | https://github.com/edelooff/sqlalchemy-json/blob/4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc/sqlalchemy_json/track.py#L56-L71 | train |
edelooff/sqlalchemy-json | sqlalchemy_json/track.py | TrackedObject.convert_items | def convert_items(self, items):
"""Generator like `convert_iterable`, but for 2-tuple iterators."""
return ((key, self.convert(value, self)) for key, value in items) | python | def convert_items(self, items):
"""Generator like `convert_iterable`, but for 2-tuple iterators."""
return ((key, self.convert(value, self)) for key, value in items) | [
"def",
"convert_items",
"(",
"self",
",",
"items",
")",
":",
"return",
"(",
"(",
"key",
",",
"self",
".",
"convert",
"(",
"value",
",",
"self",
")",
")",
"for",
"key",
",",
"value",
"in",
"items",
")"
] | Generator like `convert_iterable`, but for 2-tuple iterators. | [
"Generator",
"like",
"convert_iterable",
"but",
"for",
"2",
"-",
"tuple",
"iterators",
"."
] | 4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc | https://github.com/edelooff/sqlalchemy-json/blob/4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc/sqlalchemy_json/track.py#L77-L79 | train |
edelooff/sqlalchemy-json | sqlalchemy_json/track.py | TrackedObject.convert_mapping | def convert_mapping(self, mapping):
"""Convenience method to track either a dict or a 2-tuple iterator."""
if isinstance(mapping, dict):
return self.convert_items(iteritems(mapping))
return self.convert_items(mapping) | python | def convert_mapping(self, mapping):
"""Convenience method to track either a dict or a 2-tuple iterator."""
if isinstance(mapping, dict):
return self.convert_items(iteritems(mapping))
return self.convert_items(mapping) | [
"def",
"convert_mapping",
"(",
"self",
",",
"mapping",
")",
":",
"if",
"isinstance",
"(",
"mapping",
",",
"dict",
")",
":",
"return",
"self",
".",
"convert_items",
"(",
"iteritems",
"(",
"mapping",
")",
")",
"return",
"self",
".",
"convert_items",
"(",
"... | Convenience method to track either a dict or a 2-tuple iterator. | [
"Convenience",
"method",
"to",
"track",
"either",
"a",
"dict",
"or",
"a",
"2",
"-",
"tuple",
"iterator",
"."
] | 4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc | https://github.com/edelooff/sqlalchemy-json/blob/4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc/sqlalchemy_json/track.py#L81-L85 | train |
praekelt/django-preferences | preferences/admin.py | PreferencesAdmin.changelist_view | def changelist_view(self, request, extra_context=None):
"""
If we only have a single preference object redirect to it,
otherwise display listing.
"""
model = self.model
if model.objects.all().count() > 1:
return super(PreferencesAdmin, self).changelist_view(re... | python | def changelist_view(self, request, extra_context=None):
"""
If we only have a single preference object redirect to it,
otherwise display listing.
"""
model = self.model
if model.objects.all().count() > 1:
return super(PreferencesAdmin, self).changelist_view(re... | [
"def",
"changelist_view",
"(",
"self",
",",
"request",
",",
"extra_context",
"=",
"None",
")",
":",
"model",
"=",
"self",
".",
"model",
"if",
"model",
".",
"objects",
".",
"all",
"(",
")",
".",
"count",
"(",
")",
">",
"1",
":",
"return",
"super",
"... | If we only have a single preference object redirect to it,
otherwise display listing. | [
"If",
"we",
"only",
"have",
"a",
"single",
"preference",
"object",
"redirect",
"to",
"it",
"otherwise",
"display",
"listing",
"."
] | 724f23da45449e96feb5179cb34e3d380cf151a1 | https://github.com/praekelt/django-preferences/blob/724f23da45449e96feb5179cb34e3d380cf151a1/preferences/admin.py#L13-L30 | train |
voyages-sncf-technologies/nexus_uploader | setup.py | md2rst | def md2rst(md_lines):
'Only converts headers'
lvl2header_char = {1: '=', 2: '-', 3: '~'}
for md_line in md_lines:
if md_line.startswith('#'):
header_indent, header_text = md_line.split(' ', 1)
yield header_text
header_char = lvl2header_char[len(header_indent)]
... | python | def md2rst(md_lines):
'Only converts headers'
lvl2header_char = {1: '=', 2: '-', 3: '~'}
for md_line in md_lines:
if md_line.startswith('#'):
header_indent, header_text = md_line.split(' ', 1)
yield header_text
header_char = lvl2header_char[len(header_indent)]
... | [
"def",
"md2rst",
"(",
"md_lines",
")",
":",
"lvl2header_char",
"=",
"{",
"1",
":",
"'='",
",",
"2",
":",
"'-'",
",",
"3",
":",
"'~'",
"}",
"for",
"md_line",
"in",
"md_lines",
":",
"if",
"md_line",
".",
"startswith",
"(",
"'#'",
")",
":",
"header_in... | Only converts headers | [
"Only",
"converts",
"headers"
] | dca654f9080264b1dcaabfc2fd19f26b1c4f59fe | https://github.com/voyages-sncf-technologies/nexus_uploader/blob/dca654f9080264b1dcaabfc2fd19f26b1c4f59fe/setup.py#L24-L34 | train |
voyages-sncf-technologies/nexus_uploader | nexus_uploader/utils.py | aslist | def aslist(generator):
'Function decorator to transform a generator into a list'
def wrapper(*args, **kwargs):
return list(generator(*args, **kwargs))
return wrapper | python | def aslist(generator):
'Function decorator to transform a generator into a list'
def wrapper(*args, **kwargs):
return list(generator(*args, **kwargs))
return wrapper | [
"def",
"aslist",
"(",
"generator",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"list",
"(",
"generator",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"return",
"wrapper"
] | Function decorator to transform a generator into a list | [
"Function",
"decorator",
"to",
"transform",
"a",
"generator",
"into",
"a",
"list"
] | dca654f9080264b1dcaabfc2fd19f26b1c4f59fe | https://github.com/voyages-sncf-technologies/nexus_uploader/blob/dca654f9080264b1dcaabfc2fd19f26b1c4f59fe/nexus_uploader/utils.py#L17-L21 | train |
voyages-sncf-technologies/nexus_uploader | nexus_uploader/pypi.py | get_package_release_from_pypi | def get_package_release_from_pypi(pkg_name, version, pypi_json_api_url, allowed_classifiers):
"""
No classifier-based selection of Python packages is currently implemented: for now we don't fetch any .whl or .egg
Eventually, we should select the best release available, based on the classifier & PEP 425: htt... | python | def get_package_release_from_pypi(pkg_name, version, pypi_json_api_url, allowed_classifiers):
"""
No classifier-based selection of Python packages is currently implemented: for now we don't fetch any .whl or .egg
Eventually, we should select the best release available, based on the classifier & PEP 425: htt... | [
"def",
"get_package_release_from_pypi",
"(",
"pkg_name",
",",
"version",
",",
"pypi_json_api_url",
",",
"allowed_classifiers",
")",
":",
"matching_releases",
"=",
"get_package_releases_matching_version",
"(",
"pkg_name",
",",
"version",
",",
"pypi_json_api_url",
")",
"src... | No classifier-based selection of Python packages is currently implemented: for now we don't fetch any .whl or .egg
Eventually, we should select the best release available, based on the classifier & PEP 425: https://www.python.org/dev/peps/pep-0425/
E.g. a wheel when available but NOT for tornado 4.3 for example... | [
"No",
"classifier",
"-",
"based",
"selection",
"of",
"Python",
"packages",
"is",
"currently",
"implemented",
":",
"for",
"now",
"we",
"don",
"t",
"fetch",
"any",
".",
"whl",
"or",
".",
"egg",
"Eventually",
"we",
"should",
"select",
"the",
"best",
"release"... | dca654f9080264b1dcaabfc2fd19f26b1c4f59fe | https://github.com/voyages-sncf-technologies/nexus_uploader/blob/dca654f9080264b1dcaabfc2fd19f26b1c4f59fe/nexus_uploader/pypi.py#L27-L40 | train |
voyages-sncf-technologies/nexus_uploader | nexus_uploader/pypi.py | extract_classifier_and_extension | def extract_classifier_and_extension(pkg_name, filename):
"""
Returns a PEP425-compliant classifier (or 'py2.py3-none-any' if it cannot be extracted),
and the file extension
TODO: return a classifier 3-members namedtuple instead of a single string
"""
basename, _, extension = filename.rpartition... | python | def extract_classifier_and_extension(pkg_name, filename):
"""
Returns a PEP425-compliant classifier (or 'py2.py3-none-any' if it cannot be extracted),
and the file extension
TODO: return a classifier 3-members namedtuple instead of a single string
"""
basename, _, extension = filename.rpartition... | [
"def",
"extract_classifier_and_extension",
"(",
"pkg_name",
",",
"filename",
")",
":",
"basename",
",",
"_",
",",
"extension",
"=",
"filename",
".",
"rpartition",
"(",
"'.'",
")",
"if",
"extension",
"==",
"'gz'",
"and",
"filename",
".",
"endswith",
"(",
"'.t... | Returns a PEP425-compliant classifier (or 'py2.py3-none-any' if it cannot be extracted),
and the file extension
TODO: return a classifier 3-members namedtuple instead of a single string | [
"Returns",
"a",
"PEP425",
"-",
"compliant",
"classifier",
"(",
"or",
"py2",
".",
"py3",
"-",
"none",
"-",
"any",
"if",
"it",
"cannot",
"be",
"extracted",
")",
"and",
"the",
"file",
"extension",
"TODO",
":",
"return",
"a",
"classifier",
"3",
"-",
"membe... | dca654f9080264b1dcaabfc2fd19f26b1c4f59fe | https://github.com/voyages-sncf-technologies/nexus_uploader/blob/dca654f9080264b1dcaabfc2fd19f26b1c4f59fe/nexus_uploader/pypi.py#L62-L80 | train |
edelooff/sqlalchemy-json | sqlalchemy_json/__init__.py | NestedMutable.coerce | def coerce(cls, key, value):
"""Convert plain dictionary to NestedMutable."""
if value is None:
return value
if isinstance(value, cls):
return value
if isinstance(value, dict):
return NestedMutableDict.coerce(key, value)
if isinstance(value, li... | python | def coerce(cls, key, value):
"""Convert plain dictionary to NestedMutable."""
if value is None:
return value
if isinstance(value, cls):
return value
if isinstance(value, dict):
return NestedMutableDict.coerce(key, value)
if isinstance(value, li... | [
"def",
"coerce",
"(",
"cls",
",",
"key",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"value",
"if",
"isinstance",
"(",
"value",
",",
"cls",
")",
":",
"return",
"value",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
":"... | Convert plain dictionary to NestedMutable. | [
"Convert",
"plain",
"dictionary",
"to",
"NestedMutable",
"."
] | 4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc | https://github.com/edelooff/sqlalchemy-json/blob/4e5df0d61dc09ed9a52e24ab291a1f1e14aa95cc/sqlalchemy_json/__init__.py#L36-L46 | train |
shoeffner/cvloop | tools/create_functions_ipynb.py | is_mod_function | def is_mod_function(mod, fun):
"""Checks if a function in a module was declared in that module.
http://stackoverflow.com/a/1107150/3004221
Args:
mod: the module
fun: the function
"""
return inspect.isfunction(fun) and inspect.getmodule(fun) == mod | python | def is_mod_function(mod, fun):
"""Checks if a function in a module was declared in that module.
http://stackoverflow.com/a/1107150/3004221
Args:
mod: the module
fun: the function
"""
return inspect.isfunction(fun) and inspect.getmodule(fun) == mod | [
"def",
"is_mod_function",
"(",
"mod",
",",
"fun",
")",
":",
"return",
"inspect",
".",
"isfunction",
"(",
"fun",
")",
"and",
"inspect",
".",
"getmodule",
"(",
"fun",
")",
"==",
"mod"
] | Checks if a function in a module was declared in that module.
http://stackoverflow.com/a/1107150/3004221
Args:
mod: the module
fun: the function | [
"Checks",
"if",
"a",
"function",
"in",
"a",
"module",
"was",
"declared",
"in",
"that",
"module",
"."
] | 3ddd311e9b679d16c8fd36779931380374de343c | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/tools/create_functions_ipynb.py#L15-L24 | train |
shoeffner/cvloop | tools/create_functions_ipynb.py | is_mod_class | def is_mod_class(mod, cls):
"""Checks if a class in a module was declared in that module.
Args:
mod: the module
cls: the class
"""
return inspect.isclass(cls) and inspect.getmodule(cls) == mod | python | def is_mod_class(mod, cls):
"""Checks if a class in a module was declared in that module.
Args:
mod: the module
cls: the class
"""
return inspect.isclass(cls) and inspect.getmodule(cls) == mod | [
"def",
"is_mod_class",
"(",
"mod",
",",
"cls",
")",
":",
"return",
"inspect",
".",
"isclass",
"(",
"cls",
")",
"and",
"inspect",
".",
"getmodule",
"(",
"cls",
")",
"==",
"mod"
] | Checks if a class in a module was declared in that module.
Args:
mod: the module
cls: the class | [
"Checks",
"if",
"a",
"class",
"in",
"a",
"module",
"was",
"declared",
"in",
"that",
"module",
"."
] | 3ddd311e9b679d16c8fd36779931380374de343c | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/tools/create_functions_ipynb.py#L27-L34 | train |
shoeffner/cvloop | tools/create_functions_ipynb.py | list_functions | def list_functions(mod_name):
"""Lists all functions declared in a module.
http://stackoverflow.com/a/1107150/3004221
Args:
mod_name: the module name
Returns:
A list of functions declared in that module.
"""
mod = sys.modules[mod_name]
return [func.__name__ for func in mod.... | python | def list_functions(mod_name):
"""Lists all functions declared in a module.
http://stackoverflow.com/a/1107150/3004221
Args:
mod_name: the module name
Returns:
A list of functions declared in that module.
"""
mod = sys.modules[mod_name]
return [func.__name__ for func in mod.... | [
"def",
"list_functions",
"(",
"mod_name",
")",
":",
"mod",
"=",
"sys",
".",
"modules",
"[",
"mod_name",
"]",
"return",
"[",
"func",
".",
"__name__",
"for",
"func",
"in",
"mod",
".",
"__dict__",
".",
"values",
"(",
")",
"if",
"is_mod_function",
"(",
"mo... | Lists all functions declared in a module.
http://stackoverflow.com/a/1107150/3004221
Args:
mod_name: the module name
Returns:
A list of functions declared in that module. | [
"Lists",
"all",
"functions",
"declared",
"in",
"a",
"module",
"."
] | 3ddd311e9b679d16c8fd36779931380374de343c | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/tools/create_functions_ipynb.py#L37-L49 | train |
shoeffner/cvloop | tools/create_functions_ipynb.py | list_classes | def list_classes(mod_name):
"""Lists all classes declared in a module.
Args:
mod_name: the module name
Returns:
A list of functions declared in that module.
"""
mod = sys.modules[mod_name]
return [cls.__name__ for cls in mod.__dict__.values()
if is_mod_class(mod, cls... | python | def list_classes(mod_name):
"""Lists all classes declared in a module.
Args:
mod_name: the module name
Returns:
A list of functions declared in that module.
"""
mod = sys.modules[mod_name]
return [cls.__name__ for cls in mod.__dict__.values()
if is_mod_class(mod, cls... | [
"def",
"list_classes",
"(",
"mod_name",
")",
":",
"mod",
"=",
"sys",
".",
"modules",
"[",
"mod_name",
"]",
"return",
"[",
"cls",
".",
"__name__",
"for",
"cls",
"in",
"mod",
".",
"__dict__",
".",
"values",
"(",
")",
"if",
"is_mod_class",
"(",
"mod",
"... | Lists all classes declared in a module.
Args:
mod_name: the module name
Returns:
A list of functions declared in that module. | [
"Lists",
"all",
"classes",
"declared",
"in",
"a",
"module",
"."
] | 3ddd311e9b679d16c8fd36779931380374de343c | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/tools/create_functions_ipynb.py#L52-L62 | train |
shoeffner/cvloop | tools/create_functions_ipynb.py | get_linenumbers | def get_linenumbers(functions, module, searchstr='def {}(image):\n'):
"""Returns a dictionary which maps function names to line numbers.
Args:
functions: a list of function names
module: the module to look the functions up
searchstr: the string to search for
Returns:
A di... | python | def get_linenumbers(functions, module, searchstr='def {}(image):\n'):
"""Returns a dictionary which maps function names to line numbers.
Args:
functions: a list of function names
module: the module to look the functions up
searchstr: the string to search for
Returns:
A di... | [
"def",
"get_linenumbers",
"(",
"functions",
",",
"module",
",",
"searchstr",
"=",
"'def {}(image):\\n'",
")",
":",
"lines",
"=",
"inspect",
".",
"getsourcelines",
"(",
"module",
")",
"[",
"0",
"]",
"line_numbers",
"=",
"{",
"}",
"for",
"function",
"in",
"f... | Returns a dictionary which maps function names to line numbers.
Args:
functions: a list of function names
module: the module to look the functions up
searchstr: the string to search for
Returns:
A dictionary with functions as keys and their line numbers as values. | [
"Returns",
"a",
"dictionary",
"which",
"maps",
"function",
"names",
"to",
"line",
"numbers",
"."
] | 3ddd311e9b679d16c8fd36779931380374de343c | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/tools/create_functions_ipynb.py#L65-L84 | train |
shoeffner/cvloop | tools/create_functions_ipynb.py | format_doc | def format_doc(fun):
"""Formats the documentation in a nicer way and for notebook cells."""
SEPARATOR = '============================='
func = cvloop.functions.__dict__[fun]
doc_lines = ['{}'.format(l).strip() for l in func.__doc__.split('\n')]
if hasattr(func, '__init__'):
doc_lines.append... | python | def format_doc(fun):
"""Formats the documentation in a nicer way and for notebook cells."""
SEPARATOR = '============================='
func = cvloop.functions.__dict__[fun]
doc_lines = ['{}'.format(l).strip() for l in func.__doc__.split('\n')]
if hasattr(func, '__init__'):
doc_lines.append... | [
"def",
"format_doc",
"(",
"fun",
")",
":",
"SEPARATOR",
"=",
"'============================='",
"func",
"=",
"cvloop",
".",
"functions",
".",
"__dict__",
"[",
"fun",
"]",
"doc_lines",
"=",
"[",
"'{}'",
".",
"format",
"(",
"l",
")",
".",
"strip",
"(",
")"... | Formats the documentation in a nicer way and for notebook cells. | [
"Formats",
"the",
"documentation",
"in",
"a",
"nicer",
"way",
"and",
"for",
"notebook",
"cells",
"."
] | 3ddd311e9b679d16c8fd36779931380374de343c | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/tools/create_functions_ipynb.py#L87-L121 | train |
shoeffner/cvloop | tools/create_functions_ipynb.py | main | def main():
"""Main function creates the cvloop.functions example notebook."""
notebook = {
'cells': [
{
'cell_type': 'markdown',
'metadata': {},
'source': [
'# cvloop functions\n\n',
'This notebook shows... | python | def main():
"""Main function creates the cvloop.functions example notebook."""
notebook = {
'cells': [
{
'cell_type': 'markdown',
'metadata': {},
'source': [
'# cvloop functions\n\n',
'This notebook shows... | [
"def",
"main",
"(",
")",
":",
"notebook",
"=",
"{",
"'cells'",
":",
"[",
"{",
"'cell_type'",
":",
"'markdown'",
",",
"'metadata'",
":",
"{",
"}",
",",
"'source'",
":",
"[",
"'# cvloop functions\\n\\n'",
",",
"'This notebook shows an overview over all cvloop '",
... | Main function creates the cvloop.functions example notebook. | [
"Main",
"function",
"creates",
"the",
"cvloop",
".",
"functions",
"example",
"notebook",
"."
] | 3ddd311e9b679d16c8fd36779931380374de343c | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/tools/create_functions_ipynb.py#L161-L212 | train |
shoeffner/cvloop | cvloop/cvloop.py | prepare_axes | def prepare_axes(axes, title, size, cmap=None):
"""Prepares an axes object for clean plotting.
Removes x and y axes labels and ticks, sets the aspect ratio to be
equal, uses the size to determine the drawing area and fills the image
with random colors as visual feedback.
Creates an AxesImage to be... | python | def prepare_axes(axes, title, size, cmap=None):
"""Prepares an axes object for clean plotting.
Removes x and y axes labels and ticks, sets the aspect ratio to be
equal, uses the size to determine the drawing area and fills the image
with random colors as visual feedback.
Creates an AxesImage to be... | [
"def",
"prepare_axes",
"(",
"axes",
",",
"title",
",",
"size",
",",
"cmap",
"=",
"None",
")",
":",
"if",
"axes",
"is",
"None",
":",
"return",
"None",
"# prepare axis itself",
"axes",
".",
"set_xlim",
"(",
"[",
"0",
",",
"size",
"[",
"1",
"]",
"]",
... | Prepares an axes object for clean plotting.
Removes x and y axes labels and ticks, sets the aspect ratio to be
equal, uses the size to determine the drawing area and fills the image
with random colors as visual feedback.
Creates an AxesImage to be shown inside the axes object and sets the
needed p... | [
"Prepares",
"an",
"axes",
"object",
"for",
"clean",
"plotting",
"."
] | 3ddd311e9b679d16c8fd36779931380374de343c | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L29-L67 | train |
shoeffner/cvloop | cvloop/cvloop.py | cvloop.connect_event_handlers | def connect_event_handlers(self):
"""Connects event handlers to the figure."""
self.figure.canvas.mpl_connect('close_event', self.evt_release)
self.figure.canvas.mpl_connect('pause_event', self.evt_toggle_pause) | python | def connect_event_handlers(self):
"""Connects event handlers to the figure."""
self.figure.canvas.mpl_connect('close_event', self.evt_release)
self.figure.canvas.mpl_connect('pause_event', self.evt_toggle_pause) | [
"def",
"connect_event_handlers",
"(",
"self",
")",
":",
"self",
".",
"figure",
".",
"canvas",
".",
"mpl_connect",
"(",
"'close_event'",
",",
"self",
".",
"evt_release",
")",
"self",
".",
"figure",
".",
"canvas",
".",
"mpl_connect",
"(",
"'pause_event'",
",",... | Connects event handlers to the figure. | [
"Connects",
"event",
"handlers",
"to",
"the",
"figure",
"."
] | 3ddd311e9b679d16c8fd36779931380374de343c | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L237-L240 | train |
shoeffner/cvloop | cvloop/cvloop.py | cvloop.evt_toggle_pause | def evt_toggle_pause(self, *args): # pylint: disable=unused-argument
"""Pauses and resumes the video source."""
if self.event_source._timer is None: # noqa: e501 pylint: disable=protected-access
self.event_source.start()
else:
self.event_source.stop() | python | def evt_toggle_pause(self, *args): # pylint: disable=unused-argument
"""Pauses and resumes the video source."""
if self.event_source._timer is None: # noqa: e501 pylint: disable=protected-access
self.event_source.start()
else:
self.event_source.stop() | [
"def",
"evt_toggle_pause",
"(",
"self",
",",
"*",
"args",
")",
":",
"# pylint: disable=unused-argument",
"if",
"self",
".",
"event_source",
".",
"_timer",
"is",
"None",
":",
"# noqa: e501 pylint: disable=protected-access",
"self",
".",
"event_source",
".",
"start",
... | Pauses and resumes the video source. | [
"Pauses",
"and",
"resumes",
"the",
"video",
"source",
"."
] | 3ddd311e9b679d16c8fd36779931380374de343c | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L249-L254 | train |
shoeffner/cvloop | cvloop/cvloop.py | cvloop.print_info | def print_info(self, capture):
"""Prints information about the unprocessed image.
Reads one frame from the source to determine image colors, dimensions
and data types.
Args:
capture: the source to read from.
"""
self.frame_offset += 1
ret, frame = ca... | python | def print_info(self, capture):
"""Prints information about the unprocessed image.
Reads one frame from the source to determine image colors, dimensions
and data types.
Args:
capture: the source to read from.
"""
self.frame_offset += 1
ret, frame = ca... | [
"def",
"print_info",
"(",
"self",
",",
"capture",
")",
":",
"self",
".",
"frame_offset",
"+=",
"1",
"ret",
",",
"frame",
"=",
"capture",
".",
"read",
"(",
")",
"if",
"ret",
":",
"print",
"(",
"'Capture Information'",
")",
"print",
"(",
"'\\tDimensions (H... | Prints information about the unprocessed image.
Reads one frame from the source to determine image colors, dimensions
and data types.
Args:
capture: the source to read from. | [
"Prints",
"information",
"about",
"the",
"unprocessed",
"image",
"."
] | 3ddd311e9b679d16c8fd36779931380374de343c | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L256-L276 | train |
shoeffner/cvloop | cvloop/cvloop.py | cvloop.determine_size | def determine_size(self, capture):
"""Determines the height and width of the image source.
If no dimensions are available, this method defaults to a resolution of
640x480, thus returns (480, 640).
If capture has a get method it is assumed to understand
`cv2.CAP_PROP_FRAME_WIDTH`... | python | def determine_size(self, capture):
"""Determines the height and width of the image source.
If no dimensions are available, this method defaults to a resolution of
640x480, thus returns (480, 640).
If capture has a get method it is assumed to understand
`cv2.CAP_PROP_FRAME_WIDTH`... | [
"def",
"determine_size",
"(",
"self",
",",
"capture",
")",
":",
"width",
"=",
"640",
"height",
"=",
"480",
"if",
"capture",
"and",
"hasattr",
"(",
"capture",
",",
"'get'",
")",
":",
"width",
"=",
"capture",
".",
"get",
"(",
"cv2",
".",
"CAP_PROP_FRAME_... | Determines the height and width of the image source.
If no dimensions are available, this method defaults to a resolution of
640x480, thus returns (480, 640).
If capture has a get method it is assumed to understand
`cv2.CAP_PROP_FRAME_WIDTH` and `cv2.CAP_PROP_FRAME_HEIGHT` to get the
... | [
"Determines",
"the",
"height",
"and",
"width",
"of",
"the",
"image",
"source",
"."
] | 3ddd311e9b679d16c8fd36779931380374de343c | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L278-L305 | train |
shoeffner/cvloop | cvloop/cvloop.py | cvloop._init_draw | def _init_draw(self):
"""Initializes the drawing of the frames by setting the images to
random colors.
This function is called by TimedAnimation.
"""
if self.original is not None:
self.original.set_data(np.random.random((10, 10, 3)))
self.processed.set_data(n... | python | def _init_draw(self):
"""Initializes the drawing of the frames by setting the images to
random colors.
This function is called by TimedAnimation.
"""
if self.original is not None:
self.original.set_data(np.random.random((10, 10, 3)))
self.processed.set_data(n... | [
"def",
"_init_draw",
"(",
"self",
")",
":",
"if",
"self",
".",
"original",
"is",
"not",
"None",
":",
"self",
".",
"original",
".",
"set_data",
"(",
"np",
".",
"random",
".",
"random",
"(",
"(",
"10",
",",
"10",
",",
"3",
")",
")",
")",
"self",
... | Initializes the drawing of the frames by setting the images to
random colors.
This function is called by TimedAnimation. | [
"Initializes",
"the",
"drawing",
"of",
"the",
"frames",
"by",
"setting",
"the",
"images",
"to",
"random",
"colors",
"."
] | 3ddd311e9b679d16c8fd36779931380374de343c | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L320-L328 | train |
shoeffner/cvloop | cvloop/cvloop.py | cvloop.read_frame | def read_frame(self):
"""Reads a frame and converts the color if needed.
In case no frame is available, i.e. self.capture.read() returns False
as the first return value, the event_source of the TimedAnimation is
stopped, and if possible the capture source released.
Returns:
... | python | def read_frame(self):
"""Reads a frame and converts the color if needed.
In case no frame is available, i.e. self.capture.read() returns False
as the first return value, the event_source of the TimedAnimation is
stopped, and if possible the capture source released.
Returns:
... | [
"def",
"read_frame",
"(",
"self",
")",
":",
"ret",
",",
"frame",
"=",
"self",
".",
"capture",
".",
"read",
"(",
")",
"if",
"not",
"ret",
":",
"self",
".",
"event_source",
".",
"stop",
"(",
")",
"try",
":",
"self",
".",
"capture",
".",
"release",
... | Reads a frame and converts the color if needed.
In case no frame is available, i.e. self.capture.read() returns False
as the first return value, the event_source of the TimedAnimation is
stopped, and if possible the capture source released.
Returns:
None if stopped, otherwi... | [
"Reads",
"a",
"frame",
"and",
"converts",
"the",
"color",
"if",
"needed",
"."
] | 3ddd311e9b679d16c8fd36779931380374de343c | https://github.com/shoeffner/cvloop/blob/3ddd311e9b679d16c8fd36779931380374de343c/cvloop/cvloop.py#L330-L351 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.