hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f648fa7f2db64201644eb5a37143ea7885e9852d | vliz-be-opsci/pykg2tbl | pykg2tbl/service.py | [
"MIT"
] | Python | query | QueryResult | def query(self, sparql:str) -> QueryResult:
"""
function that queries data with the given sparql
:param sparql: sparql statement logic for querying data.
"""
pass |
function that queries data with the given sparql
:param sparql: sparql statement logic for querying data.
| function that queries data with the given sparql | [
"function",
"that",
"queries",
"data",
"with",
"the",
"given",
"sparql"
] | def query(self, sparql:str) -> QueryResult:
pass | [
"def",
"query",
"(",
"self",
",",
"sparql",
":",
"str",
")",
"->",
"QueryResult",
":",
"pass"
] | function that queries data with the given sparql | [
"function",
"that",
"queries",
"data",
"with",
"the",
"given",
"sparql"
] | [
"\"\"\"\n function that queries data with the given sparql\n \n :param sparql: sparql statement logic for querying data.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "sparql",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sparql",
"type": "str",
"docstring": "sparql statement logic for qu... |
f648fa7f2db64201644eb5a37143ea7885e9852d | vliz-be-opsci/pykg2tbl | pykg2tbl/service.py | [
"MIT"
] | Python | build_sparql_query | null | def build_sparql_query(self, name: str, **variables):
"""
Builds the named sparql query by applying the provided params
:param name: Name of the query.
:param variables: Dict of all the variables to give to the template to make the sparql query.
:type name: str
... |
Builds the named sparql query by applying the provided params
:param name: Name of the query.
:param variables: Dict of all the variables to give to the template to make the sparql query.
:type name: str
| Builds the named sparql query by applying the provided params | [
"Builds",
"the",
"named",
"sparql",
"query",
"by",
"applying",
"the",
"provided",
"params"
] | def build_sparql_query(self, name: str, **variables):
pass | [
"def",
"build_sparql_query",
"(",
"self",
",",
"name",
":",
"str",
",",
"**",
"variables",
")",
":",
"pass"
] | Builds the named sparql query by applying the provided params | [
"Builds",
"the",
"named",
"sparql",
"query",
"by",
"applying",
"the",
"provided",
"params"
] | [
"\"\"\"\n Builds the named sparql query by applying the provided params\n\n :param name: Name of the query.\n :param variables: Dict of all the variables to give to the template to make the sparql query.\n \n :type name: str\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "str",
"docstring": "Name of the query.",
"doc... |
f648fa7f2db64201644eb5a37143ea7885e9852d | vliz-be-opsci/pykg2tbl | pykg2tbl/service.py | [
"MIT"
] | Python | variables_in_query | null | def variables_in_query(self, name:str):
"""
Return the set of all the variable names applicable to the named query
:param name: [Name of the query.]
:type name: str
:return: the set of all variables applicable to the named query.
:rtype: set
"""... |
Return the set of all the variable names applicable to the named query
:param name: [Name of the query.]
:type name: str
:return: the set of all variables applicable to the named query.
:rtype: set
| Return the set of all the variable names applicable to the named query | [
"Return",
"the",
"set",
"of",
"all",
"the",
"variable",
"names",
"applicable",
"to",
"the",
"named",
"query"
] | def variables_in_query(self, name:str):
pass | [
"def",
"variables_in_query",
"(",
"self",
",",
"name",
":",
"str",
")",
":",
"pass"
] | Return the set of all the variable names applicable to the named query | [
"Return",
"the",
"set",
"of",
"all",
"the",
"variable",
"names",
"applicable",
"to",
"the",
"named",
"query"
] | [
"\"\"\"\n Return the set of all the variable names applicable to the named query\n\n :param name: [Name of the query.]\n :type name: str\n \n :return: the set of all variables applicable to the named query.\n :rtype: set\n \n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": "str"
}
] | {
"returns": [
{
"docstring": "the set of all variables applicable to the named query.",
"docstring_tokens": [
"the",
"set",
"of",
"all",
"variables",
"applicable",
"to",
"the",
"named",
"query",
"."
],
... |
b114dc9329e66464a6d403a42d5ca6275e1cfc8b | vliz-be-opsci/pykg2tbl | pykg2tbl/__main__.py | [
"MIT"
] | Python | main | null | def main(sysargs = None):
"""
The main entry point to this module.
"""
print('sysargs=', sysargs)
args = get_arg_parser().parse_args(sysargs) if sysargs is not None and len(sysargs) > 0 else get_arg_parser().parse_args()
enable_logging(args)
log.info("The args passed to %s are: %s." % (sys.... |
The main entry point to this module.
| The main entry point to this module. | [
"The",
"main",
"entry",
"point",
"to",
"this",
"module",
"."
] | def main(sysargs = None):
print('sysargs=', sysargs)
args = get_arg_parser().parse_args(sysargs) if sysargs is not None and len(sysargs) > 0 else get_arg_parser().parse_args()
enable_logging(args)
log.info("The args passed to %s are: %s." % (sys.argv[0], args))
log.debug("Performing service")
pe... | [
"def",
"main",
"(",
"sysargs",
"=",
"None",
")",
":",
"print",
"(",
"'sysargs='",
",",
"sysargs",
")",
"args",
"=",
"get_arg_parser",
"(",
")",
".",
"parse_args",
"(",
"sysargs",
")",
"if",
"sysargs",
"is",
"not",
"None",
"and",
"len",
"(",
"sysargs",
... | The main entry point to this module. | [
"The",
"main",
"entry",
"point",
"to",
"this",
"module",
"."
] | [
"\"\"\"\n The main entry point to this module.\n\n \"\"\""
] | [
{
"param": "sysargs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sysargs",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fab7d96e97c82fa673ee33de83014c313e7ae30d | vliz-be-opsci/pykg2tbl | pykg2tbl/j2/jinja_sparql_builder.py | [
"MIT"
] | Python | variables_in_query | set | def variables_in_query(self, name:str) -> set:
"""
The set of variables to make this template work
:param name: name of the template to inspect
:returns: set of variable-names
:rtype: set of str
"""
template_name = name
templates_env = self._templ... |
The set of variables to make this template work
:param name: name of the template to inspect
:returns: set of variable-names
:rtype: set of str
| The set of variables to make this template work | [
"The",
"set",
"of",
"variables",
"to",
"make",
"this",
"template",
"work"
] | def variables_in_query(self, name:str) -> set:
template_name = name
templates_env = self._templates_env
log.debug(f"name template: {template_name}")
template_source = templates_env.loader.get_source(templates_env, template_name)
log.debug(f"template source = {template_source}")
... | [
"def",
"variables_in_query",
"(",
"self",
",",
"name",
":",
"str",
")",
"->",
"set",
":",
"template_name",
"=",
"name",
"templates_env",
"=",
"self",
".",
"_templates_env",
"log",
".",
"debug",
"(",
"f\"name template: {template_name}\"",
")",
"template_source",
... | The set of variables to make this template work | [
"The",
"set",
"of",
"variables",
"to",
"make",
"this",
"template",
"work"
] | [
"\"\"\"\n The set of variables to make this template work\n \n :param name: name of the template to inspect\n :returns: set of variable-names\n :rtype: set of str\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": "str"
}
] | {
"returns": [
{
"docstring": "set of variable-names",
"docstring_tokens": [
"set",
"of",
"variable",
"-",
"names"
],
"type": "set of str"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring... |
e0836c2aad189c99bd4dabb09aae5f1a55ec5260 | igor-simoes/nameko-prometheus | src/nameko_prometheus/dependencies.py | [
"Apache-2.0"
] | Python | expose_metrics | Response | def expose_metrics(self, request: Request) -> Response:
"""
Returns metrics as a HTTP response in Prometheus text format.
"""
if "name" not in request.args:
logger.debug(
"Registry name(s) not found in query string, using global registry"
)
... |
Returns metrics as a HTTP response in Prometheus text format.
| Returns metrics as a HTTP response in Prometheus text format. | [
"Returns",
"metrics",
"as",
"a",
"HTTP",
"response",
"in",
"Prometheus",
"text",
"format",
"."
] | def expose_metrics(self, request: Request) -> Response:
if "name" not in request.args:
logger.debug(
"Registry name(s) not found in query string, using global registry"
)
registry = REGISTRY
else:
names = request.args.getlist("name")
... | [
"def",
"expose_metrics",
"(",
"self",
",",
"request",
":",
"Request",
")",
"->",
"Response",
":",
"if",
"\"name\"",
"not",
"in",
"request",
".",
"args",
":",
"logger",
".",
"debug",
"(",
"\"Registry name(s) not found in query string, using global registry\"",
")",
... | Returns metrics as a HTTP response in Prometheus text format. | [
"Returns",
"metrics",
"as",
"a",
"HTTP",
"response",
"in",
"Prometheus",
"text",
"format",
"."
] | [
"\"\"\"\n Returns metrics as a HTTP response in Prometheus text format.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "request",
"type": "Request"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "request",
"type": "Request",
"docstring": null,
"docstring_to... |
e0836c2aad189c99bd4dabb09aae5f1a55ec5260 | igor-simoes/nameko-prometheus | src/nameko_prometheus/dependencies.py | [
"Apache-2.0"
] | Python | worker_setup | None | def worker_setup(self, worker_ctx: WorkerContext) -> None:
"""
Called before service worker starts.
"""
self.worker_starts[worker_ctx] = time.perf_counter() |
Called before service worker starts.
| Called before service worker starts. | [
"Called",
"before",
"service",
"worker",
"starts",
"."
] | def worker_setup(self, worker_ctx: WorkerContext) -> None:
self.worker_starts[worker_ctx] = time.perf_counter() | [
"def",
"worker_setup",
"(",
"self",
",",
"worker_ctx",
":",
"WorkerContext",
")",
"->",
"None",
":",
"self",
".",
"worker_starts",
"[",
"worker_ctx",
"]",
"=",
"time",
".",
"perf_counter",
"(",
")"
] | Called before service worker starts. | [
"Called",
"before",
"service",
"worker",
"starts",
"."
] | [
"\"\"\"\n Called before service worker starts.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "worker_ctx",
"type": "WorkerContext"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "worker_ctx",
"type": "WorkerContext",
"docstring": null,
"doc... |
e0836c2aad189c99bd4dabb09aae5f1a55ec5260 | igor-simoes/nameko-prometheus | src/nameko_prometheus/dependencies.py | [
"Apache-2.0"
] | Python | worker_result | None | def worker_result(
self, worker_ctx: WorkerContext, result=None, exc_info=None
) -> None:
"""
Called after service worker completes.
At this point the default metrics such as worker latency are observed,
regardless of whether the worker finished successfully or raised an
... |
Called after service worker completes.
At this point the default metrics such as worker latency are observed,
regardless of whether the worker finished successfully or raised an
exception.
| Called after service worker completes.
At this point the default metrics such as worker latency are observed,
regardless of whether the worker finished successfully or raised an
exception. | [
"Called",
"after",
"service",
"worker",
"completes",
".",
"At",
"this",
"point",
"the",
"default",
"metrics",
"such",
"as",
"worker",
"latency",
"are",
"observed",
"regardless",
"of",
"whether",
"the",
"worker",
"finished",
"successfully",
"or",
"raised",
"an",
... | def worker_result(
self, worker_ctx: WorkerContext, result=None, exc_info=None
) -> None:
try:
start = self.worker_starts.pop(worker_ctx)
except KeyError:
logger.warning("No worker_ctx in request start dictionary")
return
worker_summary = WorkerSum... | [
"def",
"worker_result",
"(",
"self",
",",
"worker_ctx",
":",
"WorkerContext",
",",
"result",
"=",
"None",
",",
"exc_info",
"=",
"None",
")",
"->",
"None",
":",
"try",
":",
"start",
"=",
"self",
".",
"worker_starts",
".",
"pop",
"(",
"worker_ctx",
")",
... | Called after service worker completes. | [
"Called",
"after",
"service",
"worker",
"completes",
"."
] | [
"\"\"\"\n Called after service worker completes.\n\n At this point the default metrics such as worker latency are observed,\n regardless of whether the worker finished successfully or raised an\n exception.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "worker_ctx",
"type": "WorkerContext"
},
{
"param": "result",
"type": null
},
{
"param": "exc_info",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "worker_ctx",
"type": "WorkerContext",
"docstring": null,
"doc... |
52f83d42f2e2ae0f16ba9480def027d71d6c82f7 | delthas/bliss | python/bliss/bl_song.py | [
"MIT"
] | Python | decode | null | def decode(self, filename):
"""
Decode an audio file and load it into this `bl_song` object. Do not run
any analysis on it.
Params:
- filename is the path to the file to load.
"""
filename_char = ffi.new("char[]", filename.encode("utf-8"))
lib.bl_audi... |
Decode an audio file and load it into this `bl_song` object. Do not run
any analysis on it.
Params:
- filename is the path to the file to load.
| Decode an audio file and load it into this `bl_song` object. Do not run
any analysis on it.
filename is the path to the file to load. | [
"Decode",
"an",
"audio",
"file",
"and",
"load",
"it",
"into",
"this",
"`",
"bl_song",
"`",
"object",
".",
"Do",
"not",
"run",
"any",
"analysis",
"on",
"it",
".",
"filename",
"is",
"the",
"path",
"to",
"the",
"file",
"to",
"load",
"."
] | def decode(self, filename):
filename_char = ffi.new("char[]", filename.encode("utf-8"))
lib.bl_audio_decode(filename_char, self._c_struct) | [
"def",
"decode",
"(",
"self",
",",
"filename",
")",
":",
"filename_char",
"=",
"ffi",
".",
"new",
"(",
"\"char[]\"",
",",
"filename",
".",
"encode",
"(",
"\"utf-8\"",
")",
")",
"lib",
".",
"bl_audio_decode",
"(",
"filename_char",
",",
"self",
".",
"_c_st... | Decode an audio file and load it into this `bl_song` object. | [
"Decode",
"an",
"audio",
"file",
"and",
"load",
"it",
"into",
"this",
"`",
"bl_song",
"`",
"object",
"."
] | [
"\"\"\"\n Decode an audio file and load it into this `bl_song` object. Do not run\n any analysis on it.\n\n Params:\n - filename is the path to the file to load.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
52f83d42f2e2ae0f16ba9480def027d71d6c82f7 | delthas/bliss | python/bliss/bl_song.py | [
"MIT"
] | Python | analyze | null | def analyze(self, filename):
"""
Load and analyze an audio file, putting it in a `bl_song` object.
Params:
- filename is the path to the file to load and analyze.
"""
filename_char = ffi.new("char[]", filename.encode("utf-8"))
lib.bl_analyze(filename_char, se... |
Load and analyze an audio file, putting it in a `bl_song` object.
Params:
- filename is the path to the file to load and analyze.
| Load and analyze an audio file, putting it in a `bl_song` object.
Params:
filename is the path to the file to load and analyze. | [
"Load",
"and",
"analyze",
"an",
"audio",
"file",
"putting",
"it",
"in",
"a",
"`",
"bl_song",
"`",
"object",
".",
"Params",
":",
"filename",
"is",
"the",
"path",
"to",
"the",
"file",
"to",
"load",
"and",
"analyze",
"."
] | def analyze(self, filename):
filename_char = ffi.new("char[]", filename.encode("utf-8"))
lib.bl_analyze(filename_char, self._c_struct) | [
"def",
"analyze",
"(",
"self",
",",
"filename",
")",
":",
"filename_char",
"=",
"ffi",
".",
"new",
"(",
"\"char[]\"",
",",
"filename",
".",
"encode",
"(",
"\"utf-8\"",
")",
")",
"lib",
".",
"bl_analyze",
"(",
"filename_char",
",",
"self",
".",
"_c_struct... | Load and analyze an audio file, putting it in a `bl_song` object. | [
"Load",
"and",
"analyze",
"an",
"audio",
"file",
"putting",
"it",
"in",
"a",
"`",
"bl_song",
"`",
"object",
"."
] | [
"\"\"\"\n Load and analyze an audio file, putting it in a `bl_song` object.\n\n Params:\n - filename is the path to the file to load and analyze.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
52f83d42f2e2ae0f16ba9480def027d71d6c82f7 | delthas/bliss | python/bliss/bl_song.py | [
"MIT"
] | Python | envelope_analysis | <not_specific> | def envelope_analysis(self):
"""
Run an envelope analysis on a previously loaded file.
Returns a {tempo, attack} dict, which is a direct mapping of
`struct envelope_result_s`. Also updates the object data members.
"""
result = ffi.new("struct envelope_result_s *")
... |
Run an envelope analysis on a previously loaded file.
Returns a {tempo, attack} dict, which is a direct mapping of
`struct envelope_result_s`. Also updates the object data members.
| Run an envelope analysis on a previously loaded file.
Returns a {tempo, attack} dict, which is a direct mapping of
`struct envelope_result_s`. Also updates the object data members. | [
"Run",
"an",
"envelope",
"analysis",
"on",
"a",
"previously",
"loaded",
"file",
".",
"Returns",
"a",
"{",
"tempo",
"attack",
"}",
"dict",
"which",
"is",
"a",
"direct",
"mapping",
"of",
"`",
"struct",
"envelope_result_s",
"`",
".",
"Also",
"updates",
"the",... | def envelope_analysis(self):
result = ffi.new("struct envelope_result_s *")
lib.bl_envelope_sort(self._c_struct, result)
return {
"tempo": (result.tempo),
"attack": result.attack
} | [
"def",
"envelope_analysis",
"(",
"self",
")",
":",
"result",
"=",
"ffi",
".",
"new",
"(",
"\"struct envelope_result_s *\"",
")",
"lib",
".",
"bl_envelope_sort",
"(",
"self",
".",
"_c_struct",
",",
"result",
")",
"return",
"{",
"\"tempo\"",
":",
"(",
"result"... | Run an envelope analysis on a previously loaded file. | [
"Run",
"an",
"envelope",
"analysis",
"on",
"a",
"previously",
"loaded",
"file",
"."
] | [
"\"\"\"\n Run an envelope analysis on a previously loaded file.\n\n Returns a {tempo, attack} dict, which is a direct mapping of\n `struct envelope_result_s`. Also updates the object data members.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
52f83d42f2e2ae0f16ba9480def027d71d6c82f7 | delthas/bliss | python/bliss/bl_song.py | [
"MIT"
] | Python | amplitude_analysis | null | def amplitude_analysis(self):
"""
Run an amplitude analysis on a previously loaded file.
Returns a the score obtained. Also updates the object data members.
"""
lib.bl_amplitude_sort(self._c_struct) |
Run an amplitude analysis on a previously loaded file.
Returns a the score obtained. Also updates the object data members.
| Run an amplitude analysis on a previously loaded file.
Returns a the score obtained. Also updates the object data members. | [
"Run",
"an",
"amplitude",
"analysis",
"on",
"a",
"previously",
"loaded",
"file",
".",
"Returns",
"a",
"the",
"score",
"obtained",
".",
"Also",
"updates",
"the",
"object",
"data",
"members",
"."
] | def amplitude_analysis(self):
lib.bl_amplitude_sort(self._c_struct) | [
"def",
"amplitude_analysis",
"(",
"self",
")",
":",
"lib",
".",
"bl_amplitude_sort",
"(",
"self",
".",
"_c_struct",
")"
] | Run an amplitude analysis on a previously loaded file. | [
"Run",
"an",
"amplitude",
"analysis",
"on",
"a",
"previously",
"loaded",
"file",
"."
] | [
"\"\"\"\n Run an amplitude analysis on a previously loaded file.\n\n Returns a the score obtained. Also updates the object data members.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
52f83d42f2e2ae0f16ba9480def027d71d6c82f7 | delthas/bliss | python/bliss/bl_song.py | [
"MIT"
] | Python | frequency_analysis | null | def frequency_analysis(self):
"""
Run a frequency analysis on a previously loaded file.
Returns a the score obtained. Also updates the object data members.
"""
lib.bl_frequency_sort(self._c_struct) |
Run a frequency analysis on a previously loaded file.
Returns a the score obtained. Also updates the object data members.
| Run a frequency analysis on a previously loaded file.
Returns a the score obtained. Also updates the object data members. | [
"Run",
"a",
"frequency",
"analysis",
"on",
"a",
"previously",
"loaded",
"file",
".",
"Returns",
"a",
"the",
"score",
"obtained",
".",
"Also",
"updates",
"the",
"object",
"data",
"members",
"."
] | def frequency_analysis(self):
lib.bl_frequency_sort(self._c_struct) | [
"def",
"frequency_analysis",
"(",
"self",
")",
":",
"lib",
".",
"bl_frequency_sort",
"(",
"self",
".",
"_c_struct",
")"
] | Run a frequency analysis on a previously loaded file. | [
"Run",
"a",
"frequency",
"analysis",
"on",
"a",
"previously",
"loaded",
"file",
"."
] | [
"\"\"\"\n Run a frequency analysis on a previously loaded file.\n\n Returns a the score obtained. Also updates the object data members.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
52f83d42f2e2ae0f16ba9480def027d71d6c82f7 | delthas/bliss | python/bliss/bl_song.py | [
"MIT"
] | Python | free | null | def free(self):
"""
Free dynamically allocated data in the underlying C struct (artist,
genre, etc). Must be called at deletion to prevent memory leaks.
"""
for k in list(self._keepalive):
del(self._keepalive[k])
self.set(k, ffi.NULL)
lib.bl_free_s... |
Free dynamically allocated data in the underlying C struct (artist,
genre, etc). Must be called at deletion to prevent memory leaks.
| Free dynamically allocated data in the underlying C struct (artist,
genre, etc). Must be called at deletion to prevent memory leaks. | [
"Free",
"dynamically",
"allocated",
"data",
"in",
"the",
"underlying",
"C",
"struct",
"(",
"artist",
"genre",
"etc",
")",
".",
"Must",
"be",
"called",
"at",
"deletion",
"to",
"prevent",
"memory",
"leaks",
"."
] | def free(self):
for k in list(self._keepalive):
del(self._keepalive[k])
self.set(k, ffi.NULL)
lib.bl_free_song(self._c_struct) | [
"def",
"free",
"(",
"self",
")",
":",
"for",
"k",
"in",
"list",
"(",
"self",
".",
"_keepalive",
")",
":",
"del",
"(",
"self",
".",
"_keepalive",
"[",
"k",
"]",
")",
"self",
".",
"set",
"(",
"k",
",",
"ffi",
".",
"NULL",
")",
"lib",
".",
"bl_f... | Free dynamically allocated data in the underlying C struct (artist,
genre, etc). | [
"Free",
"dynamically",
"allocated",
"data",
"in",
"the",
"underlying",
"C",
"struct",
"(",
"artist",
"genre",
"etc",
")",
"."
] | [
"\"\"\"\n Free dynamically allocated data in the underlying C struct (artist,\n genre, etc). Must be called at deletion to prevent memory leaks.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c6db54089fceb4490051f9054354f831fe620144 | delthas/bliss | python/bliss/version.py | [
"MIT"
] | Python | version | <not_specific> | def version():
"""
Wrapper around `bl_version` function which returns the current version.
"""
return lib.bl_version() |
Wrapper around `bl_version` function which returns the current version.
| Wrapper around `bl_version` function which returns the current version. | [
"Wrapper",
"around",
"`",
"bl_version",
"`",
"function",
"which",
"returns",
"the",
"current",
"version",
"."
] | def version():
return lib.bl_version() | [
"def",
"version",
"(",
")",
":",
"return",
"lib",
".",
"bl_version",
"(",
")"
] | Wrapper around `bl_version` function which returns the current version. | [
"Wrapper",
"around",
"`",
"bl_version",
"`",
"function",
"which",
"returns",
"the",
"current",
"version",
"."
] | [
"\"\"\"\n Wrapper around `bl_version` function which returns the current version.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
8b773bd7c74d11891c8e2fb6d1677b9f9f0f8393 | delthas/bliss | python/buildtools/pkgconfig.py | [
"MIT"
] | Python | _compare_versions | <not_specific> | def _compare_versions(v1, v2):
"""
Compare two version strings and return -1, 0 or 1 depending on the equality
of the subset of matching version numbers.
The implementation is taken from the top answer at
http://stackoverflow.com/a/1714190/997768.
"""
def normalize(v):
return [int(x... |
Compare two version strings and return -1, 0 or 1 depending on the equality
of the subset of matching version numbers.
The implementation is taken from the top answer at
http://stackoverflow.com/a/1714190/997768.
| Compare two version strings and return -1, 0 or 1 depending on the equality
of the subset of matching version numbers.
| [
"Compare",
"two",
"version",
"strings",
"and",
"return",
"-",
"1",
"0",
"or",
"1",
"depending",
"on",
"the",
"equality",
"of",
"the",
"subset",
"of",
"matching",
"version",
"numbers",
"."
] | def _compare_versions(v1, v2):
def normalize(v):
return [int(x) for x in re.sub(r'(\.0+)*$', '', v).split(".")]
n1 = normalize(v1)
n2 = normalize(v2)
return (n1 > n2) - (n1 < n2) | [
"def",
"_compare_versions",
"(",
"v1",
",",
"v2",
")",
":",
"def",
"normalize",
"(",
"v",
")",
":",
"return",
"[",
"int",
"(",
"x",
")",
"for",
"x",
"in",
"re",
".",
"sub",
"(",
"r'(\\.0+)*$'",
",",
"''",
",",
"v",
")",
".",
"split",
"(",
"\".\... | Compare two version strings and return -1, 0 or 1 depending on the equality
of the subset of matching version numbers. | [
"Compare",
"two",
"version",
"strings",
"and",
"return",
"-",
"1",
"0",
"or",
"1",
"depending",
"on",
"the",
"equality",
"of",
"the",
"subset",
"of",
"matching",
"version",
"numbers",
"."
] | [
"\"\"\"\n Compare two version strings and return -1, 0 or 1 depending on the equality\n of the subset of matching version numbers.\n\n The implementation is taken from the top answer at\n http://stackoverflow.com/a/1714190/997768.\n \"\"\""
] | [
{
"param": "v1",
"type": null
},
{
"param": "v2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "v1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "v2",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
8b773bd7c74d11891c8e2fb6d1677b9f9f0f8393 | delthas/bliss | python/buildtools/pkgconfig.py | [
"MIT"
] | Python | installed | <not_specific> | def installed(package, version):
"""
Check if the package meets the required version.
The version specifier consists of an optional comparator (one of =, ==, >,
<, >=, <=) and an arbitrarily long version number separated by dots. The
should be as you would expect, e.g. for an installed version '0.1... |
Check if the package meets the required version.
The version specifier consists of an optional comparator (one of =, ==, >,
<, >=, <=) and an arbitrarily long version number separated by dots. The
should be as you would expect, e.g. for an installed version '0.1.2' of
package 'foo':
>>> insta... | Check if the package meets the required version.
| [
"Check",
"if",
"the",
"package",
"meets",
"the",
"required",
"version",
"."
] | def installed(package, version):
if not exists(package):
return False
number, comparator = _split_version_specifier(version)
modversion = _query(package, '--modversion')
try:
result = _compare_versions(modversion, number)
except ValueError:
msg = "{0} is not a correct version... | [
"def",
"installed",
"(",
"package",
",",
"version",
")",
":",
"if",
"not",
"exists",
"(",
"package",
")",
":",
"return",
"False",
"number",
",",
"comparator",
"=",
"_split_version_specifier",
"(",
"version",
")",
"modversion",
"=",
"_query",
"(",
"package",
... | Check if the package meets the required version. | [
"Check",
"if",
"the",
"package",
"meets",
"the",
"required",
"version",
"."
] | [
"\"\"\"\n Check if the package meets the required version.\n\n The version specifier consists of an optional comparator (one of =, ==, >,\n <, >=, <=) and an arbitrarily long version number separated by dots. The\n should be as you would expect, e.g. for an installed version '0.1.2' of\n package 'foo... | [
{
"param": "package",
"type": null
},
{
"param": "version",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "package",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "version",
"type": null,
"docstring": null,
"docstring_toke... |
8b773bd7c74d11891c8e2fb6d1677b9f9f0f8393 | delthas/bliss | python/buildtools/pkgconfig.py | [
"MIT"
] | Python | parse | <not_specific> | def parse(packages):
"""
Parse the output from pkg-config about the passed package or packages.
Builds a dictionary containing the 'libraries', the 'library_dirs',
the 'include_dirs', and the 'define_macros' that are presented by
pkg-config. *package* is a string with space-delimited package names.... |
Parse the output from pkg-config about the passed package or packages.
Builds a dictionary containing the 'libraries', the 'library_dirs',
the 'include_dirs', and the 'define_macros' that are presented by
pkg-config. *package* is a string with space-delimited package names.
| Parse the output from pkg-config about the passed package or packages. | [
"Parse",
"the",
"output",
"from",
"pkg",
"-",
"config",
"about",
"the",
"passed",
"package",
"or",
"packages",
"."
] | def parse(packages):
def parse_package(package):
result = collections.defaultdict(set)
out = _query(package, '--cflags --libs')
out = out.replace('\\"', '')
for token in out.split():
key = _PARSE_MAP.get(token[:2])
if key:
result[key].add(token... | [
"def",
"parse",
"(",
"packages",
")",
":",
"def",
"parse_package",
"(",
"package",
")",
":",
"result",
"=",
"collections",
".",
"defaultdict",
"(",
"set",
")",
"out",
"=",
"_query",
"(",
"package",
",",
"'--cflags --libs'",
")",
"out",
"=",
"out",
".",
... | Parse the output from pkg-config about the passed package or packages. | [
"Parse",
"the",
"output",
"from",
"pkg",
"-",
"config",
"about",
"the",
"passed",
"package",
"or",
"packages",
"."
] | [
"\"\"\"\n Parse the output from pkg-config about the passed package or packages.\n\n Builds a dictionary containing the 'libraries', the 'library_dirs',\n the 'include_dirs', and the 'define_macros' that are presented by\n pkg-config. *package* is a string with space-delimited package names.\n \"\"\"... | [
{
"param": "packages",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "packages",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e8c2a89bcd641ddc60aa8ce77f8649453c1b5e66 | pavelzimin/microsoft_malware | src/models/train_model.py | [
"MIT"
] | Python | data_split | <not_specific> | def data_split(df, y_col, to_drop=[], random_state=None, hold1_size=.1, hold2_size=.1, hold3_size=.1):
""" Splits the dataframe into the train set and 3 hold-out sets.
Drops columns to drop and the target variable from the DataFrame df. Then the rows are reshuffled and split into 4 groups: train set and 3 hold... | Splits the dataframe into the train set and 3 hold-out sets.
Drops columns to drop and the target variable from the DataFrame df. Then the rows are reshuffled and split into 4 groups: train set and 3 hold-out sets.
Args:
df: pandas DataFrame with the data.
y_col: the name of the column with t... | Splits the dataframe into the train set and 3 hold-out sets.
Drops columns to drop and the target variable from the DataFrame df. Then the rows are reshuffled and split into 4 groups: train set and 3 hold-out sets. | [
"Splits",
"the",
"dataframe",
"into",
"the",
"train",
"set",
"and",
"3",
"hold",
"-",
"out",
"sets",
".",
"Drops",
"columns",
"to",
"drop",
"and",
"the",
"target",
"variable",
"from",
"the",
"DataFrame",
"df",
".",
"Then",
"the",
"rows",
"are",
"reshuffl... | def data_split(df, y_col, to_drop=[], random_state=None, hold1_size=.1, hold2_size=.1, hold3_size=.1):
df_filtered = df.drop(columns=to_drop)
rows = list(df_filtered.index)
if random_state is not None:
random.seed(random_state)
random.shuffle(rows)
length = len(rows)
train_rows = rows[:i... | [
"def",
"data_split",
"(",
"df",
",",
"y_col",
",",
"to_drop",
"=",
"[",
"]",
",",
"random_state",
"=",
"None",
",",
"hold1_size",
"=",
".1",
",",
"hold2_size",
"=",
".1",
",",
"hold3_size",
"=",
".1",
")",
":",
"df_filtered",
"=",
"df",
".",
"drop",
... | Splits the dataframe into the train set and 3 hold-out sets. | [
"Splits",
"the",
"dataframe",
"into",
"the",
"train",
"set",
"and",
"3",
"hold",
"-",
"out",
"sets",
"."
] | [
"\"\"\" Splits the dataframe into the train set and 3 hold-out sets.\n\n Drops columns to drop and the target variable from the DataFrame df. Then the rows are reshuffled and split into 4 groups: train set and 3 hold-out sets.\n\n Args:\n df: pandas DataFrame with the data.\n y_col: the name of ... | [
{
"param": "df",
"type": null
},
{
"param": "y_col",
"type": null
},
{
"param": "to_drop",
"type": null
},
{
"param": "random_state",
"type": null
},
{
"param": "hold1_size",
"type": null
},
{
"param": "hold2_size",
"type": null
},
{
"param... | {
"returns": [
{
"docstring": "A tuple of length 9 containing train set, 3 hold-out sets split of inputs and a list of column labels.",
"docstring_tokens": [
"A",
"tuple",
"of",
"length",
"9",
"containing",
"train",
"set",
"3",
... |
e8c2a89bcd641ddc60aa8ce77f8649453c1b5e66 | pavelzimin/microsoft_malware | src/models/train_model.py | [
"MIT"
] | Python | preproc | <not_specific> | def preproc(X_train, X_val, cat_cols, cols_to_keep):
""" Preprocesses training and validation sets ready for the neural network training.
For each categorical column, the function remaps the values to the integer values and adds a one-dimensional
numpy array of with mapped values to the output list. Other ... | Preprocesses training and validation sets ready for the neural network training.
For each categorical column, the function remaps the values to the integer values and adds a one-dimensional
numpy array of with mapped values to the output list. Other columns are treated as numeric and added as numpy array
... | Preprocesses training and validation sets ready for the neural network training.
For each categorical column, the function remaps the values to the integer values and adds a one-dimensional
numpy array of with mapped values to the output list. Other columns are treated as numeric and added as numpy array
as the last el... | [
"Preprocesses",
"training",
"and",
"validation",
"sets",
"ready",
"for",
"the",
"neural",
"network",
"training",
".",
"For",
"each",
"categorical",
"column",
"the",
"function",
"remaps",
"the",
"values",
"to",
"the",
"integer",
"values",
"and",
"adds",
"a",
"o... | def preproc(X_train, X_val, cat_cols, cols_to_keep):
other_cols = [not c in cat_cols for c in cols_to_keep]
input_list_train = []
input_list_val = []
for c in cat_cols:
el_index = cols_to_keep.index(c)
raw_vals = np.unique(np.concatenate((X_train, X_val), axis=0)[:, el_index])
ra... | [
"def",
"preproc",
"(",
"X_train",
",",
"X_val",
",",
"cat_cols",
",",
"cols_to_keep",
")",
":",
"other_cols",
"=",
"[",
"not",
"c",
"in",
"cat_cols",
"for",
"c",
"in",
"cols_to_keep",
"]",
"input_list_train",
"=",
"[",
"]",
"input_list_val",
"=",
"[",
"]... | Preprocesses training and validation sets ready for the neural network training. | [
"Preprocesses",
"training",
"and",
"validation",
"sets",
"ready",
"for",
"the",
"neural",
"network",
"training",
"."
] | [
"\"\"\" Preprocesses training and validation sets ready for the neural network training.\n\n For each categorical column, the function remaps the values to the integer values and adds a one-dimensional\n numpy array of with mapped values to the output list. Other columns are treated as numeric and added as nu... | [
{
"param": "X_train",
"type": null
},
{
"param": "X_val",
"type": null
},
{
"param": "cat_cols",
"type": null
},
{
"param": "cols_to_keep",
"type": null
}
] | {
"returns": [
{
"docstring": "a list with preprocessed data ready for an entity embedding neural network model.",
"docstring_tokens": [
"a",
"list",
"with",
"preprocessed",
"data",
"ready",
"for",
"an",
"entity",
"embeddi... |
e8c2a89bcd641ddc60aa8ce77f8649453c1b5e66 | pavelzimin/microsoft_malware | src/models/train_model.py | [
"MIT"
] | Python | build_embedding_network | <not_specific> | def build_embedding_network(X_train, X_val, cat_cols, cols_to_keep, n_num=100, n=60, d=False, verbose=False):
""" Builds a neural network model with entity embedding for categorical variables.
The function builds the neural network, for which it creates entity embedding for each categorical feature specified
... | Builds a neural network model with entity embedding for categorical variables.
The function builds the neural network, for which it creates entity embedding for each categorical feature specified
in cat_cols argument. Numerical features are projected ot a dense layer. Entity embedding with the numerical
f... | Builds a neural network model with entity embedding for categorical variables.
The function builds the neural network, for which it creates entity embedding for each categorical feature specified
in cat_cols argument. Numerical features are projected ot a dense layer. Entity embedding with the numerical
features projec... | [
"Builds",
"a",
"neural",
"network",
"model",
"with",
"entity",
"embedding",
"for",
"categorical",
"variables",
".",
"The",
"function",
"builds",
"the",
"neural",
"network",
"for",
"which",
"it",
"creates",
"entity",
"embedding",
"for",
"each",
"categorical",
"fe... | def build_embedding_network(X_train, X_val, cat_cols, cols_to_keep, n_num=100, n=60, d=False, verbose=False):
inputs = []
embeddings = []
for categorical_var in cat_cols:
if verbose:
print("------------------------------------------------------------------")
print("for catego... | [
"def",
"build_embedding_network",
"(",
"X_train",
",",
"X_val",
",",
"cat_cols",
",",
"cols_to_keep",
",",
"n_num",
"=",
"100",
",",
"n",
"=",
"60",
",",
"d",
"=",
"False",
",",
"verbose",
"=",
"False",
")",
":",
"inputs",
"=",
"[",
"]",
"embeddings",
... | Builds a neural network model with entity embedding for categorical variables. | [
"Builds",
"a",
"neural",
"network",
"model",
"with",
"entity",
"embedding",
"for",
"categorical",
"variables",
"."
] | [
"\"\"\" Builds a neural network model with entity embedding for categorical variables.\n\n The function builds the neural network, for which it creates entity embedding for each categorical feature specified\n in cat_cols argument. Numerical features are projected ot a dense layer. Entity embedding with the n... | [
{
"param": "X_train",
"type": null
},
{
"param": "X_val",
"type": null
},
{
"param": "cat_cols",
"type": null
},
{
"param": "cols_to_keep",
"type": null
},
{
"param": "n_num",
"type": null
},
{
"param": "n",
"type": null
},
{
"param": "d",
... | {
"returns": [
{
"docstring": "neural network model.",
"docstring_tokens": [
"neural",
"network",
"model",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "X_train",
"type": null,
"docstring": "training set ... |
e8c2a89bcd641ddc60aa8ce77f8649453c1b5e66 | pavelzimin/microsoft_malware | src/models/train_model.py | [
"MIT"
] | Python | build_embedding_network_3 | <not_specific> | def build_embedding_network_3(X_train, X_val, cat_cols, cols_to_keep, n_num=120, n1=150, n2=50, d=False, lr=0.001, verbose=False):
"""Builds a neural network model with entity embedding for categorical variables.
The function builds the neural network, for which it creates entity embedding for each categorical... | Builds a neural network model with entity embedding for categorical variables.
The function builds the neural network, for which it creates entity embedding for each categorical feature specified
in cat_cols argument. Numerical features are projected ot a dense layer. Entity embeddings are concatenated with
... | Builds a neural network model with entity embedding for categorical variables.
The function builds the neural network, for which it creates entity embedding for each categorical feature specified
in cat_cols argument. Numerical features are projected ot a dense layer. Entity embeddings are concatenated with
layer numer... | [
"Builds",
"a",
"neural",
"network",
"model",
"with",
"entity",
"embedding",
"for",
"categorical",
"variables",
".",
"The",
"function",
"builds",
"the",
"neural",
"network",
"for",
"which",
"it",
"creates",
"entity",
"embedding",
"for",
"each",
"categorical",
"fe... | def build_embedding_network_3(X_train, X_val, cat_cols, cols_to_keep, n_num=120, n1=150, n2=50, d=False, lr=0.001, verbose=False):
inputs = []
embeddings = []
for categorical_var in cat_cols:
if verbose:
print("------------------------------------------------------------------")
... | [
"def",
"build_embedding_network_3",
"(",
"X_train",
",",
"X_val",
",",
"cat_cols",
",",
"cols_to_keep",
",",
"n_num",
"=",
"120",
",",
"n1",
"=",
"150",
",",
"n2",
"=",
"50",
",",
"d",
"=",
"False",
",",
"lr",
"=",
"0.001",
",",
"verbose",
"=",
"Fals... | Builds a neural network model with entity embedding for categorical variables. | [
"Builds",
"a",
"neural",
"network",
"model",
"with",
"entity",
"embedding",
"for",
"categorical",
"variables",
"."
] | [
"\"\"\"Builds a neural network model with entity embedding for categorical variables.\n\n The function builds the neural network, for which it creates entity embedding for each categorical feature specified\n in cat_cols argument. Numerical features are projected ot a dense layer. Entity embeddings are concat... | [
{
"param": "X_train",
"type": null
},
{
"param": "X_val",
"type": null
},
{
"param": "cat_cols",
"type": null
},
{
"param": "cols_to_keep",
"type": null
},
{
"param": "n_num",
"type": null
},
{
"param": "n1",
"type": null
},
{
"param": "n2"... | {
"returns": [
{
"docstring": "neural network model.",
"docstring_tokens": [
"neural",
"network",
"model",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "X_train",
"type": null,
"docstring": "training set ... |
e8c2a89bcd641ddc60aa8ce77f8649453c1b5e66 | pavelzimin/microsoft_malware | src/models/train_model.py | [
"MIT"
] | Python | grid_search | <not_specific> | def grid_search(estimator, param_grid, X_train, y_train, X_test, y_test, batch_size=10000, nn=False):
""" Performs grid search over parameter grid.
Function iterates over the combinations of parameters in the parameter grid. Trains the estimator on the X_train.
Evaluation is done on both the training set a... | Performs grid search over parameter grid.
Function iterates over the combinations of parameters in the parameter grid. Trains the estimator on the X_train.
Evaluation is done on both the training set and validation set. The parameters reported are ROC AUC score calculated
on the training and test sets.
... | Performs grid search over parameter grid.
Function iterates over the combinations of parameters in the parameter grid. Trains the estimator on the X_train.
Evaluation is done on both the training set and validation set. The parameters reported are ROC AUC score calculated
on the training and test sets. | [
"Performs",
"grid",
"search",
"over",
"parameter",
"grid",
".",
"Function",
"iterates",
"over",
"the",
"combinations",
"of",
"parameters",
"in",
"the",
"parameter",
"grid",
".",
"Trains",
"the",
"estimator",
"on",
"the",
"X_train",
".",
"Evaluation",
"is",
"do... | def grid_search(estimator, param_grid, X_train, y_train, X_test, y_test, batch_size=10000, nn=False):
out = pd.DataFrame()
for g in ParameterGrid(param_grid):
estimator.set_params(**g)
if nn:
print('Fitting with params:', g)
early_stopping_monitor = EarlyStopping(patience... | [
"def",
"grid_search",
"(",
"estimator",
",",
"param_grid",
",",
"X_train",
",",
"y_train",
",",
"X_test",
",",
"y_test",
",",
"batch_size",
"=",
"10000",
",",
"nn",
"=",
"False",
")",
":",
"out",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"for",
"g",
"in... | Performs grid search over parameter grid. | [
"Performs",
"grid",
"search",
"over",
"parameter",
"grid",
"."
] | [
"\"\"\" Performs grid search over parameter grid.\n\n Function iterates over the combinations of parameters in the parameter grid. Trains the estimator on the X_train.\n Evaluation is done on both the training set and validation set. The parameters reported are ROC AUC score calculated\n on the training an... | [
{
"param": "estimator",
"type": null
},
{
"param": "param_grid",
"type": null
},
{
"param": "X_train",
"type": null
},
{
"param": "y_train",
"type": null
},
{
"param": "X_test",
"type": null
},
{
"param": "y_test",
"type": null
},
{
"param"... | {
"returns": [
{
"docstring": "a pandas DataFrame with the parameter combinations and the corresponding model evaluation metrics.",
"docstring_tokens": [
"a",
"pandas",
"DataFrame",
"with",
"the",
"parameter",
"combinations",
"and",
... |
e8c2a89bcd641ddc60aa8ce77f8649453c1b5e66 | pavelzimin/microsoft_malware | src/models/train_model.py | [
"MIT"
] | Python | fit_GBC | null | def fit_GBC(alg, X, y, X_valid, y_valid, X_cols, printFeatureImportance=True):
""" Fits the Gradient Boosting on the training set, evaluates the ROC AUC score on the training and validation set.
Plots the feature importance plot.
:param alg: Gradient Boosting Classifier model
:param X: training set inp... | Fits the Gradient Boosting on the training set, evaluates the ROC AUC score on the training and validation set.
Plots the feature importance plot.
:param alg: Gradient Boosting Classifier model
:param X: training set input variables
:param y: training set target variable
:param X_valid: validation... | Fits the Gradient Boosting on the training set, evaluates the ROC AUC score on the training and validation set.
Plots the feature importance plot. | [
"Fits",
"the",
"Gradient",
"Boosting",
"on",
"the",
"training",
"set",
"evaluates",
"the",
"ROC",
"AUC",
"score",
"on",
"the",
"training",
"and",
"validation",
"set",
".",
"Plots",
"the",
"feature",
"importance",
"plot",
"."
] | def fit_GBC(alg, X, y, X_valid, y_valid, X_cols, printFeatureImportance=True):
alg.fit(X, y)
y_predictions = alg.predict(X)
y_predprob = alg.predict_proba(X)[:, 1]
y_valid_predprob = alg.predict_proba(X_valid)[:, 1]
print("\nModel Report")
print("Accuracy : %.4g" % accuracy_score(y, y_prediction... | [
"def",
"fit_GBC",
"(",
"alg",
",",
"X",
",",
"y",
",",
"X_valid",
",",
"y_valid",
",",
"X_cols",
",",
"printFeatureImportance",
"=",
"True",
")",
":",
"alg",
".",
"fit",
"(",
"X",
",",
"y",
")",
"y_predictions",
"=",
"alg",
".",
"predict",
"(",
"X"... | Fits the Gradient Boosting on the training set, evaluates the ROC AUC score on the training and validation set. | [
"Fits",
"the",
"Gradient",
"Boosting",
"on",
"the",
"training",
"set",
"evaluates",
"the",
"ROC",
"AUC",
"score",
"on",
"the",
"training",
"and",
"validation",
"set",
"."
] | [
"\"\"\" Fits the Gradient Boosting on the training set, evaluates the ROC AUC score on the training and validation set.\n Plots the feature importance plot.\n\n :param alg: Gradient Boosting Classifier model\n :param X: training set input variables\n :param y: training set target variable\n :param X_... | [
{
"param": "alg",
"type": null
},
{
"param": "X",
"type": null
},
{
"param": "y",
"type": null
},
{
"param": "X_valid",
"type": null
},
{
"param": "y_valid",
"type": null
},
{
"param": "X_cols",
"type": null
},
{
"param": "printFeatureImpor... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "alg",
"type": null,
"docstring": "Gradient Boosting Classifier model",
"docstring_tokens": [
"Gradient",
"Boosting",
"Classifier",
"model"
],
"default": null,
"is_optional": nu... |
efeab87f92935ede096a42feec187c8a37e79062 | simeoncarstens/ensemble_hic | ensemble_hic/backbone_prior.py | [
"Unlicense",
"MIT"
] | Python | _single_structure_log_prob | <not_specific> | def _single_structure_log_prob(self, structure, ll, ul):
"""Evaluates log-probability for a single structure
:param structure: coordinates of a single structure
:type structure: :class:`numpy.ndarray`
:param ll: lower distance limits for consecutive beads
:type ll: :class:`nump... | Evaluates log-probability for a single structure
:param structure: coordinates of a single structure
:type structure: :class:`numpy.ndarray`
:param ll: lower distance limits for consecutive beads
:type ll: :class:`numpy.ndarray`
:param ul: upper distance limits for consecutive... | Evaluates log-probability for a single structure | [
"Evaluates",
"log",
"-",
"probability",
"for",
"a",
"single",
"structure"
] | def _single_structure_log_prob(self, structure, ll, ul):
x = structure.reshape(-1, 3)
k_bb = self['k_bb'].value
d = np.sqrt(np.sum((x[1:] - x[:-1]) ** 2, 1))
u_viols = d > ul
l_viols = d < ll
delta = ul - ll
return -0.5 * k_bb * ( np.sum((d[u_viols] - ul[u_viols]... | [
"def",
"_single_structure_log_prob",
"(",
"self",
",",
"structure",
",",
"ll",
",",
"ul",
")",
":",
"x",
"=",
"structure",
".",
"reshape",
"(",
"-",
"1",
",",
"3",
")",
"k_bb",
"=",
"self",
"[",
"'k_bb'",
"]",
".",
"value",
"d",
"=",
"np",
".",
"... | Evaluates log-probability for a single structure | [
"Evaluates",
"log",
"-",
"probability",
"for",
"a",
"single",
"structure"
] | [
"\"\"\"Evaluates log-probability for a single structure\n\n :param structure: coordinates of a single structure\n :type structure: :class:`numpy.ndarray`\n\n :param ll: lower distance limits for consecutive beads\n :type ll: :class:`numpy.ndarray`\n\n :param ul: upper distance lim... | [
{
"param": "self",
"type": null
},
{
"param": "structure",
"type": null
},
{
"param": "ll",
"type": null
},
{
"param": "ul",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null... |
efeab87f92935ede096a42feec187c8a37e79062 | simeoncarstens/ensemble_hic | ensemble_hic/backbone_prior.py | [
"Unlicense",
"MIT"
] | Python | _single_structure_gradient | <not_specific> | def _single_structure_gradient(self, structure, ll, ul):
"""Evaluates gradient of energy for a single structure
:param structure: coordinates of a single structure
:type structure: :class:`numpy.ndarray`
:param ll: lower distance limits for consecutive beads.
This wi... | Evaluates gradient of energy for a single structure
:param structure: coordinates of a single structure
:type structure: :class:`numpy.ndarray`
:param ll: lower distance limits for consecutive beads.
This will have length # of beads - 1
:type ll: :class:`numpy.ndarra... | Evaluates gradient of energy for a single structure | [
"Evaluates",
"gradient",
"of",
"energy",
"for",
"a",
"single",
"structure"
] | def _single_structure_gradient(self, structure, ll, ul):
return backbone_prior_gradient(structure.ravel(), ll, ul, self['k_bb'].value) | [
"def",
"_single_structure_gradient",
"(",
"self",
",",
"structure",
",",
"ll",
",",
"ul",
")",
":",
"return",
"backbone_prior_gradient",
"(",
"structure",
".",
"ravel",
"(",
")",
",",
"ll",
",",
"ul",
",",
"self",
"[",
"'k_bb'",
"]",
".",
"value",
")"
] | Evaluates gradient of energy for a single structure | [
"Evaluates",
"gradient",
"of",
"energy",
"for",
"a",
"single",
"structure"
] | [
"\"\"\"Evaluates gradient of energy for a single structure\n\n :param structure: coordinates of a single structure\n :type structure: :class:`numpy.ndarray`\n\n :param ll: lower distance limits for consecutive beads.\n This will have length # of beads - 1\n :type ll: :c... | [
{
"param": "self",
"type": null
},
{
"param": "structure",
"type": null
},
{
"param": "ll",
"type": null
},
{
"param": "ul",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": ":class:`numpy.ndarray`"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"i... |
efeab87f92935ede096a42feec187c8a37e79062 | simeoncarstens/ensemble_hic | ensemble_hic/backbone_prior.py | [
"Unlicense",
"MIT"
] | Python | _evaluate_log_prob | <not_specific> | def _evaluate_log_prob(self, structures):
"""Evaluates log-probability of a structure ensemble
:param structures: coordinates of structure ensemble
:type structures: :class:`numpy.ndarray`
:returns: log-probability of the structure ensemble
:rtype: float
"""
lo... | Evaluates log-probability of a structure ensemble
:param structures: coordinates of structure ensemble
:type structures: :class:`numpy.ndarray`
:returns: log-probability of the structure ensemble
:rtype: float
| Evaluates log-probability of a structure ensemble | [
"Evaluates",
"log",
"-",
"probability",
"of",
"a",
"structure",
"ensemble"
] | def _evaluate_log_prob(self, structures):
log_prob = self._single_structure_log_prob
X = structures.reshape(self.n_structures, -1, 3)
mr = self._mol_ranges
ll, ul = self.lower_limits, self.upper_limits
def ss_lp(x):
return np.sum([log_prob(x[mr[i]:mr[i+1]], ll[i], ul[... | [
"def",
"_evaluate_log_prob",
"(",
"self",
",",
"structures",
")",
":",
"log_prob",
"=",
"self",
".",
"_single_structure_log_prob",
"X",
"=",
"structures",
".",
"reshape",
"(",
"self",
".",
"n_structures",
",",
"-",
"1",
",",
"3",
")",
"mr",
"=",
"self",
... | Evaluates log-probability of a structure ensemble | [
"Evaluates",
"log",
"-",
"probability",
"of",
"a",
"structure",
"ensemble"
] | [
"\"\"\"Evaluates log-probability of a structure ensemble\n\n :param structures: coordinates of structure ensemble\n :type structures: :class:`numpy.ndarray`\n\n :returns: log-probability of the structure ensemble\n :rtype: float\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "structures",
"type": null
}
] | {
"returns": [
{
"docstring": "log-probability of the structure ensemble",
"docstring_tokens": [
"log",
"-",
"probability",
"of",
"the",
"structure",
"ensemble"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"... |
efeab87f92935ede096a42feec187c8a37e79062 | simeoncarstens/ensemble_hic | ensemble_hic/backbone_prior.py | [
"Unlicense",
"MIT"
] | Python | _evaluate_gradient | <not_specific> | def _evaluate_gradient(self, structures):
"""Evaluates gradient of energy of a structure ensemble
:param structures: coordinates of structure ensemble
:type structures: :class:`numpy.ndarray`
:returns: flattened gradient vector
:rtype: :class:`numpy.ndarray`
"""
... | Evaluates gradient of energy of a structure ensemble
:param structures: coordinates of structure ensemble
:type structures: :class:`numpy.ndarray`
:returns: flattened gradient vector
:rtype: :class:`numpy.ndarray`
| Evaluates gradient of energy of a structure ensemble | [
"Evaluates",
"gradient",
"of",
"energy",
"of",
"a",
"structure",
"ensemble"
] | def _evaluate_gradient(self, structures):
grad = self._single_structure_gradient
X = structures.reshape(self.n_structures, -1, 3)
mr = self._mol_ranges
ll, ul = self.lower_limits, self.upper_limits
def ss_grad(x):
return np.concatenate([grad(x[mr[i]:mr[i+1]], ll[i], u... | [
"def",
"_evaluate_gradient",
"(",
"self",
",",
"structures",
")",
":",
"grad",
"=",
"self",
".",
"_single_structure_gradient",
"X",
"=",
"structures",
".",
"reshape",
"(",
"self",
".",
"n_structures",
",",
"-",
"1",
",",
"3",
")",
"mr",
"=",
"self",
".",... | Evaluates gradient of energy of a structure ensemble | [
"Evaluates",
"gradient",
"of",
"energy",
"of",
"a",
"structure",
"ensemble"
] | [
"\"\"\"Evaluates gradient of energy of a structure ensemble\n\n :param structures: coordinates of structure ensemble\n :type structures: :class:`numpy.ndarray`\n\n :returns: flattened gradient vector\n :rtype: :class:`numpy.ndarray`\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "structures",
"type": null
}
] | {
"returns": [
{
"docstring": "flattened gradient vector",
"docstring_tokens": [
"flattened",
"gradient",
"vector"
],
"type": ":class:`numpy.ndarray`"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": n... |
efeab87f92935ede096a42feec187c8a37e79062 | simeoncarstens/ensemble_hic | ensemble_hic/backbone_prior.py | [
"Unlicense",
"MIT"
] | Python | clone | <not_specific> | def clone(self):
"""Returns a copy of an instance of this class
:returns: copy of this object
:rtype: :class:`.BackbonePrior`
"""
copy = self.__class__(self.name,
self.lower_limits,
self.upper_limits,
... | Returns a copy of an instance of this class
:returns: copy of this object
:rtype: :class:`.BackbonePrior`
| Returns a copy of an instance of this class | [
"Returns",
"a",
"copy",
"of",
"an",
"instance",
"of",
"this",
"class"
] | def clone(self):
copy = self.__class__(self.name,
self.lower_limits,
self.upper_limits,
self['k_bb'].value,
self.n_structures,
self._mol_ranges)
copy.fix... | [
"def",
"clone",
"(",
"self",
")",
":",
"copy",
"=",
"self",
".",
"__class__",
"(",
"self",
".",
"name",
",",
"self",
".",
"lower_limits",
",",
"self",
".",
"upper_limits",
",",
"self",
"[",
"'k_bb'",
"]",
".",
"value",
",",
"self",
".",
"n_structures... | Returns a copy of an instance of this class | [
"Returns",
"a",
"copy",
"of",
"an",
"instance",
"of",
"this",
"class"
] | [
"\"\"\"Returns a copy of an instance of this class\n\n :returns: copy of this object\n :rtype: :class:`.BackbonePrior`\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "copy of this object",
"docstring_tokens": [
"copy",
"of",
"this",
"object"
],
"type": ":class:`.BackbonePrior`"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": n... |
947b7b6d31202f72b7f363efcfb1e81c9dcfb65a | simeoncarstens/ensemble_hic | ensemble_hic/rog_prior.py | [
"Unlicense",
"MIT"
] | Python | _single_structure_log_prob | <not_specific> | def _single_structure_log_prob(self, structure):
"""
Evaluates log-probability for a single structure
:param structure: coordinates of a single structure
:type structure: :class:`numpy.ndarray`
:returns: log-probability
:rtype: float
"""
X = structure.re... |
Evaluates log-probability for a single structure
:param structure: coordinates of a single structure
:type structure: :class:`numpy.ndarray`
:returns: log-probability
:rtype: float
| Evaluates log-probability for a single structure | [
"Evaluates",
"log",
"-",
"probability",
"for",
"a",
"single",
"structure"
] | def _single_structure_log_prob(self, structure):
X = structure.reshape(-1,3)
rg = radius_of_gyration(X)
return -0.5 * self['k_rog'].value * (self['rog'].value - rg) ** 2 | [
"def",
"_single_structure_log_prob",
"(",
"self",
",",
"structure",
")",
":",
"X",
"=",
"structure",
".",
"reshape",
"(",
"-",
"1",
",",
"3",
")",
"rg",
"=",
"radius_of_gyration",
"(",
"X",
")",
"return",
"-",
"0.5",
"*",
"self",
"[",
"'k_rog'",
"]",
... | Evaluates log-probability for a single structure | [
"Evaluates",
"log",
"-",
"probability",
"for",
"a",
"single",
"structure"
] | [
"\"\"\"\n Evaluates log-probability for a single structure\n\n :param structure: coordinates of a single structure\n :type structure: :class:`numpy.ndarray`\n\n :returns: log-probability\n :rtype: float\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "structure",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null... |
947b7b6d31202f72b7f363efcfb1e81c9dcfb65a | simeoncarstens/ensemble_hic | ensemble_hic/rog_prior.py | [
"Unlicense",
"MIT"
] | Python | _single_structure_gradient | <not_specific> | def _single_structure_gradient(self, structure):
"""
Evaluates the negative log-probability gradient
for a single structure
:param structure: coordinates of a single structure
:type structure: :class:`numpy.ndarray`
:returns: gradient vector
:rtype: :class:`num... |
Evaluates the negative log-probability gradient
for a single structure
:param structure: coordinates of a single structure
:type structure: :class:`numpy.ndarray`
:returns: gradient vector
:rtype: :class:`numpy.ndarray`
| Evaluates the negative log-probability gradient
for a single structure | [
"Evaluates",
"the",
"negative",
"log",
"-",
"probability",
"gradient",
"for",
"a",
"single",
"structure"
] | def _single_structure_gradient(self, structure):
X = structure.reshape(-1,3)
r_gyr = radius_of_gyration(X)
k = self['k_rog'].value
target_rog = self['rog'].value
return -k * (target_rog - r_gyr) * (X - X.mean(0)).ravel() / r_gyr / len(X) | [
"def",
"_single_structure_gradient",
"(",
"self",
",",
"structure",
")",
":",
"X",
"=",
"structure",
".",
"reshape",
"(",
"-",
"1",
",",
"3",
")",
"r_gyr",
"=",
"radius_of_gyration",
"(",
"X",
")",
"k",
"=",
"self",
"[",
"'k_rog'",
"]",
".",
"value",
... | Evaluates the negative log-probability gradient
for a single structure | [
"Evaluates",
"the",
"negative",
"log",
"-",
"probability",
"gradient",
"for",
"a",
"single",
"structure"
] | [
"\"\"\"\n Evaluates the negative log-probability gradient \n for a single structure\n\n :param structure: coordinates of a single structure\n :type structure: :class:`numpy.ndarray`\n\n :returns: gradient vector\n :rtype: :class:`numpy.ndarray`\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "structure",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": ":class:`numpy.ndarray`"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"i... |
b661328466a8d56969a18e1af128dd6c589d1058 | simeoncarstens/ensemble_hic | ensemble_hic/analysis_functions.py | [
"Unlicense",
"MIT"
] | Python | load_samples | <not_specific> | def load_samples(samples_folder, n_replicas, n_samples,
dump_interval, burnin, interval=1):
"""Loads full results of a Replica Exchange
simulation.
:param samples_folder: directory in which samples are stored
:type samples_folder: str ending with a slash ("/")
:param n_replicas: n... | Loads full results of a Replica Exchange
simulation.
:param samples_folder: directory in which samples are stored
:type samples_folder: str ending with a slash ("/")
:param n_replicas: number of replicas
:type n_replicas: int
:param n_samples: number of samples
:type n_samples: int
:... | Loads full results of a Replica Exchange
simulation. | [
"Loads",
"full",
"results",
"of",
"a",
"Replica",
"Exchange",
"simulation",
"."
] | def load_samples(samples_folder, n_replicas, n_samples,
dump_interval, burnin, interval=1):
samples = []
for i in xrange(1, n_replicas + 1):
samples.append(load_sr_samples(samples_folder, i, n_samples, dump_interval,
burnin, interval))
return n... | [
"def",
"load_samples",
"(",
"samples_folder",
",",
"n_replicas",
",",
"n_samples",
",",
"dump_interval",
",",
"burnin",
",",
"interval",
"=",
"1",
")",
":",
"samples",
"=",
"[",
"]",
"for",
"i",
"in",
"xrange",
"(",
"1",
",",
"n_replicas",
"+",
"1",
")... | Loads full results of a Replica Exchange
simulation. | [
"Loads",
"full",
"results",
"of",
"a",
"Replica",
"Exchange",
"simulation",
"."
] | [
"\"\"\"Loads full results of a Replica Exchange\n simulation.\n\n :param samples_folder: directory in which samples are stored\n :type samples_folder: str ending with a slash (\"/\")\n\n :param n_replicas: number of replicas\n :type n_replicas: int\n\n :param n_samples: number of samples\n :typ... | [
{
"param": "samples_folder",
"type": null
},
{
"param": "n_replicas",
"type": null
},
{
"param": "n_samples",
"type": null
},
{
"param": "dump_interval",
"type": null
},
{
"param": "burnin",
"type": null
},
{
"param": "interval",
"type": null
}
] | {
"returns": [
{
"docstring": "a two-dimensional array of MCMC samples with the first axis being\nthe replicas and the second axis the samples for a given replica",
"docstring_tokens": [
"a",
"two",
"-",
"dimensional",
"array",
"of",
"MCMC",
... |
b661328466a8d56969a18e1af128dd6c589d1058 | simeoncarstens/ensemble_hic | ensemble_hic/analysis_functions.py | [
"Unlicense",
"MIT"
] | Python | load_sr_samples | <not_specific> | def load_sr_samples(samples_folder, replica_id, n_samples,
dump_interval, burnin, interval=1):
"""Loads results for a single replica resulting from a Replica Exchange
simulation.
:param samples_folder: directory in which samples are stored
:type samples_folder: str ending with a sla... | Loads results for a single replica resulting from a Replica Exchange
simulation.
:param samples_folder: directory in which samples are stored
:type samples_folder: str ending with a slash ("/")
:param replica_id: number of replica of interest, 1-based indexing
:type replica_id: int
:param n_s... | Loads results for a single replica resulting from a Replica Exchange
simulation. | [
"Loads",
"results",
"for",
"a",
"single",
"replica",
"resulting",
"from",
"a",
"Replica",
"Exchange",
"simulation",
"."
] | def load_sr_samples(samples_folder, replica_id, n_samples,
dump_interval, burnin, interval=1):
samples = []
for j in xrange((burnin / dump_interval) * dump_interval,
n_samples - dump_interval, dump_interval):
path = samples_folder + 'samples_replica{}_{}-{}.pickle... | [
"def",
"load_sr_samples",
"(",
"samples_folder",
",",
"replica_id",
",",
"n_samples",
",",
"dump_interval",
",",
"burnin",
",",
"interval",
"=",
"1",
")",
":",
"samples",
"=",
"[",
"]",
"for",
"j",
"in",
"xrange",
"(",
"(",
"burnin",
"/",
"dump_interval",
... | Loads results for a single replica resulting from a Replica Exchange
simulation. | [
"Loads",
"results",
"for",
"a",
"single",
"replica",
"resulting",
"from",
"a",
"Replica",
"Exchange",
"simulation",
"."
] | [
"\"\"\"Loads results for a single replica resulting from a Replica Exchange\n simulation.\n\n :param samples_folder: directory in which samples are stored\n :type samples_folder: str ending with a slash (\"/\")\n\n :param replica_id: number of replica of interest, 1-based indexing\n :type replica_id:... | [
{
"param": "samples_folder",
"type": null
},
{
"param": "replica_id",
"type": null
},
{
"param": "n_samples",
"type": null
},
{
"param": "dump_interval",
"type": null
},
{
"param": "burnin",
"type": null
},
{
"param": "interval",
"type": null
}
] | {
"returns": [
{
"docstring": "an array of MCMC samples",
"docstring_tokens": [
"an",
"array",
"of",
"MCMC",
"samples"
],
"type": ":class:`numpy.ndarray`"
}
],
"raises": [],
"params": [
{
"identifier": "samples_folder",
"typ... |
b661328466a8d56969a18e1af128dd6c589d1058 | simeoncarstens/ensemble_hic | ensemble_hic/analysis_functions.py | [
"Unlicense",
"MIT"
] | Python | write_ensemble | null | def write_ensemble(X, filename, mol_ranges=None, center=True):
"""Writes a structure ensemble to a PDB file.
:param X: coordinates of a structure ensemble
:type X: :class:`numpy.ndarray`
:param filename: file name of output PDB file
:type filename: str
:param mol_ranges: if writing structures... | Writes a structure ensemble to a PDB file.
:param X: coordinates of a structure ensemble
:type X: :class:`numpy.ndarray`
:param filename: file name of output PDB file
:type filename: str
:param mol_ranges: if writing structures consisting of several molecules, this
specifie... | Writes a structure ensemble to a PDB file. | [
"Writes",
"a",
"structure",
"ensemble",
"to",
"a",
"PDB",
"file",
"."
] | def write_ensemble(X, filename, mol_ranges=None, center=True):
from csb.bio.structure import Atom, ProteinResidue, Chain, Structure, Ensemble
from csb.bio.sequence import ProteinAlphabet
if center:
X -= X.mean(1)[:,None,:]
if mol_ranges is None:
mol_ranges = np.array([0, X.shape[1]])
... | [
"def",
"write_ensemble",
"(",
"X",
",",
"filename",
",",
"mol_ranges",
"=",
"None",
",",
"center",
"=",
"True",
")",
":",
"from",
"csb",
".",
"bio",
".",
"structure",
"import",
"Atom",
",",
"ProteinResidue",
",",
"Chain",
",",
"Structure",
",",
"Ensemble... | Writes a structure ensemble to a PDB file. | [
"Writes",
"a",
"structure",
"ensemble",
"to",
"a",
"PDB",
"file",
"."
] | [
"\"\"\"Writes a structure ensemble to a PDB file.\n\n :param X: coordinates of a structure ensemble\n :type X: :class:`numpy.ndarray`\n\n :param filename: file name of output PDB file\n :type filename: str\n\n :param mol_ranges: if writing structures consisting of several molecules, this\n ... | [
{
"param": "X",
"type": null
},
{
"param": "filename",
"type": null
},
{
"param": "mol_ranges",
"type": null
},
{
"param": "center",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "X",
"type": null,
"docstring": "coordinates of a structure ensemble",
"docstring_tokens": [
"coordinates",
"of",
"a",
"structure",
"ensemble"
],
"default": null,
"is_op... |
b661328466a8d56969a18e1af128dd6c589d1058 | simeoncarstens/ensemble_hic | ensemble_hic/analysis_functions.py | [
"Unlicense",
"MIT"
] | Python | write_VMD_script | null | def write_VMD_script(ensemble_pdb_file, bead_radii, output_file):
"""Writes a VMD script to show structures
This writes a VMD script loading a structure ensemble PDB file, setting
bead radii to given values and showing the structures as a chain of beads.
:param ensemble_pdb_file: path to PDB file
... | Writes a VMD script to show structures
This writes a VMD script loading a structure ensemble PDB file, setting
bead radii to given values and showing the structures as a chain of beads.
:param ensemble_pdb_file: path to PDB file
:type ensemble_pdb_file: str
:param bead_radii: bead radii
:type... | Writes a VMD script to show structures
This writes a VMD script loading a structure ensemble PDB file, setting
bead radii to given values and showing the structures as a chain of beads. | [
"Writes",
"a",
"VMD",
"script",
"to",
"show",
"structures",
"This",
"writes",
"a",
"VMD",
"script",
"loading",
"a",
"structure",
"ensemble",
"PDB",
"file",
"setting",
"bead",
"radii",
"to",
"given",
"values",
"and",
"showing",
"the",
"structures",
"as",
"a",... | def write_VMD_script(ensemble_pdb_file, bead_radii, output_file):
lines = ['color Display Background white',
'menu main on',
'menu graphics on',
'mol load pdb {}'.format(ensemble_pdb_file),
'mol color Index',
'mol delrep 0 0',
'mol repres... | [
"def",
"write_VMD_script",
"(",
"ensemble_pdb_file",
",",
"bead_radii",
",",
"output_file",
")",
":",
"lines",
"=",
"[",
"'color Display Background white'",
",",
"'menu main on'",
",",
"'menu graphics on'",
",",
"'mol load pdb {}'",
".",
"format",
"(",
"ensemble_pdb_fil... | Writes a VMD script to show structures
This writes a VMD script loading a structure ensemble PDB file, setting
bead radii to given values and showing the structures as a chain of beads. | [
"Writes",
"a",
"VMD",
"script",
"to",
"show",
"structures",
"This",
"writes",
"a",
"VMD",
"script",
"loading",
"a",
"structure",
"ensemble",
"PDB",
"file",
"setting",
"bead",
"radii",
"to",
"given",
"values",
"and",
"showing",
"the",
"structures",
"as",
"a",... | [
"\"\"\"Writes a VMD script to show structures\n\n This writes a VMD script loading a structure ensemble PDB file, setting\n bead radii to given values and showing the structures as a chain of beads.\n\n :param ensemble_pdb_file: path to PDB file\n :type ensemble_pdb_file: str\n\n :param bead_radii: b... | [
{
"param": "ensemble_pdb_file",
"type": null
},
{
"param": "bead_radii",
"type": null
},
{
"param": "output_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ensemble_pdb_file",
"type": null,
"docstring": "path to PDB file",
"docstring_tokens": [
"path",
"to",
"PDB",
"file"
],
"default": null,
"is_optional": null
},
{
... |
b661328466a8d56969a18e1af128dd6c589d1058 | simeoncarstens/ensemble_hic | ensemble_hic/analysis_functions.py | [
"Unlicense",
"MIT"
] | Python | write_pymol_script | null | def write_pymol_script(ensemble_pdb_file, bead_radii, output_file,
repr='spheres', grid=False):
"""Writes a PyMol script to show structures
This writes a PyMol script loading a structure ensemble PDB file, setting
bead radii to given values and showing the structures as a chain of be... | Writes a PyMol script to show structures
This writes a PyMol script loading a structure ensemble PDB file, setting
bead radii to given values and showing the structures as a chain of beads.
.. warning:: I'm not sure whether this works (I mostly use VMD)
:param ensemble_pdb_file: path to PDB file
:... | Writes a PyMol script to show structures
This writes a PyMol script loading a structure ensemble PDB file, setting
bead radii to given values and showing the structures as a chain of beads.
warning:: I'm not sure whether this works (I mostly use VMD) | [
"Writes",
"a",
"PyMol",
"script",
"to",
"show",
"structures",
"This",
"writes",
"a",
"PyMol",
"script",
"loading",
"a",
"structure",
"ensemble",
"PDB",
"file",
"setting",
"bead",
"radii",
"to",
"given",
"values",
"and",
"showing",
"the",
"structures",
"as",
... | def write_pymol_script(ensemble_pdb_file, bead_radii, output_file,
repr='spheres', grid=False):
epf = ensemble_pdb_file
fname = epf[-epf[::-1].find('/'):epf.find('.pdb')]
lines = ['load {}'.format(ensemble_pdb_file),
'hide all',
'util.chainbow',
... | [
"def",
"write_pymol_script",
"(",
"ensemble_pdb_file",
",",
"bead_radii",
",",
"output_file",
",",
"repr",
"=",
"'spheres'",
",",
"grid",
"=",
"False",
")",
":",
"epf",
"=",
"ensemble_pdb_file",
"fname",
"=",
"epf",
"[",
"-",
"epf",
"[",
":",
":",
"-",
"... | Writes a PyMol script to show structures
This writes a PyMol script loading a structure ensemble PDB file, setting
bead radii to given values and showing the structures as a chain of beads. | [
"Writes",
"a",
"PyMol",
"script",
"to",
"show",
"structures",
"This",
"writes",
"a",
"PyMol",
"script",
"loading",
"a",
"structure",
"ensemble",
"PDB",
"file",
"setting",
"bead",
"radii",
"to",
"given",
"values",
"and",
"showing",
"the",
"structures",
"as",
... | [
"\"\"\"Writes a PyMol script to show structures\n\n This writes a PyMol script loading a structure ensemble PDB file, setting\n bead radii to given values and showing the structures as a chain of beads.\n .. warning:: I'm not sure whether this works (I mostly use VMD)\n\n :param ensemble_pdb_file: path ... | [
{
"param": "ensemble_pdb_file",
"type": null
},
{
"param": "bead_radii",
"type": null
},
{
"param": "output_file",
"type": null
},
{
"param": "repr",
"type": null
},
{
"param": "grid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ensemble_pdb_file",
"type": null,
"docstring": "path to PDB file",
"docstring_tokens": [
"path",
"to",
"PDB",
"file"
],
"default": null,
"is_optional": null
},
{
... |
b661328466a8d56969a18e1af128dd6c589d1058 | simeoncarstens/ensemble_hic | ensemble_hic/analysis_functions.py | [
"Unlicense",
"MIT"
] | Python | load_samples_from_cfg | <not_specific> | def load_samples_from_cfg(config_file, burnin=35000):
"""Loads results of a simulation using a config file
This returns posterior samples from a simulation given a config file.
:param config_file: path to config file
:type config_file: str
:param burnin: number of MCMC samples to be discarded as ... | Loads results of a simulation using a config file
This returns posterior samples from a simulation given a config file.
:param config_file: path to config file
:type config_file: str
:param burnin: number of MCMC samples to be discarded as burnin
:type burnin: int
:returns: posterior samples... | Loads results of a simulation using a config file
This returns posterior samples from a simulation given a config file. | [
"Loads",
"results",
"of",
"a",
"simulation",
"using",
"a",
"config",
"file",
"This",
"returns",
"posterior",
"samples",
"from",
"a",
"simulation",
"given",
"a",
"config",
"file",
"."
] | def load_samples_from_cfg(config_file, burnin=35000):
from .setup_functions import parse_config_file
cfg = parse_config_file(config_file)
output_folder = cfg['general']['output_folder']
n_beads = int(cfg['general']['n_beads'])
n_structures = int(cfg['general']['n_structures'])
n_samples = int(cf... | [
"def",
"load_samples_from_cfg",
"(",
"config_file",
",",
"burnin",
"=",
"35000",
")",
":",
"from",
".",
"setup_functions",
"import",
"parse_config_file",
"cfg",
"=",
"parse_config_file",
"(",
"config_file",
")",
"output_folder",
"=",
"cfg",
"[",
"'general'",
"]",
... | Loads results of a simulation using a config file
This returns posterior samples from a simulation given a config file. | [
"Loads",
"results",
"of",
"a",
"simulation",
"using",
"a",
"config",
"file",
"This",
"returns",
"posterior",
"samples",
"from",
"a",
"simulation",
"given",
"a",
"config",
"file",
"."
] | [
"\"\"\"Loads results of a simulation using a config file\n\n This returns posterior samples from a simulation given a config file.\n\n :param config_file: path to config file\n :type config_file: str\n\n :param burnin: number of MCMC samples to be discarded as burnin\n :type burnin: int\n\n :retur... | [
{
"param": "config_file",
"type": null
},
{
"param": "burnin",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": ":class:`numpy.ndarray`"
}
],
"raises": [],
"params": [
{
"identifier": "config_file",
"type": null,
"docstring": "path to config file",
"docstring_tokens": [
"... |
b661328466a8d56969a18e1af128dd6c589d1058 | simeoncarstens/ensemble_hic | ensemble_hic/analysis_functions.py | [
"Unlicense",
"MIT"
] | Python | load_samples_from_cfg_auto | <not_specific> | def load_samples_from_cfg_auto(config_file, burnin=35000):
"""Loads results of a simulation using a config file
This returns posterior samples from a simulation given a config file
and automatically determines the number of actually drawn samples,
i.e., it ignores to the n_samples setting in the config... | Loads results of a simulation using a config file
This returns posterior samples from a simulation given a config file
and automatically determines the number of actually drawn samples,
i.e., it ignores to the n_samples setting in the config file.
:param config_file: path to config file
:type conf... | Loads results of a simulation using a config file
This returns posterior samples from a simulation given a config file
and automatically determines the number of actually drawn samples,
i.e., it ignores to the n_samples setting in the config file. | [
"Loads",
"results",
"of",
"a",
"simulation",
"using",
"a",
"config",
"file",
"This",
"returns",
"posterior",
"samples",
"from",
"a",
"simulation",
"given",
"a",
"config",
"file",
"and",
"automatically",
"determines",
"the",
"number",
"of",
"actually",
"drawn",
... | def load_samples_from_cfg_auto(config_file, burnin=35000):
import os
from .setup_functions import parse_config_file
cfg = parse_config_file(config_file)
output_folder = cfg['general']['output_folder']
n_structures = int(cfg['general']['n_structures'])
n_replicas = int(cfg['replica']['n_replicas'... | [
"def",
"load_samples_from_cfg_auto",
"(",
"config_file",
",",
"burnin",
"=",
"35000",
")",
":",
"import",
"os",
"from",
".",
"setup_functions",
"import",
"parse_config_file",
"cfg",
"=",
"parse_config_file",
"(",
"config_file",
")",
"output_folder",
"=",
"cfg",
"[... | Loads results of a simulation using a config file
This returns posterior samples from a simulation given a config file
and automatically determines the number of actually drawn samples,
i.e., it ignores to the n_samples setting in the config file. | [
"Loads",
"results",
"of",
"a",
"simulation",
"using",
"a",
"config",
"file",
"This",
"returns",
"posterior",
"samples",
"from",
"a",
"simulation",
"given",
"a",
"config",
"file",
"and",
"automatically",
"determines",
"the",
"number",
"of",
"actually",
"drawn",
... | [
"\"\"\"Loads results of a simulation using a config file\n\n This returns posterior samples from a simulation given a config file\n and automatically determines the number of actually drawn samples,\n i.e., it ignores to the n_samples setting in the config file.\n\n :param config_file: path to config fi... | [
{
"param": "config_file",
"type": null
},
{
"param": "burnin",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": ":class:`numpy.ndarray`"
}
],
"raises": [],
"params": [
{
"identifier": "config_file",
"type": null,
"docstring": "path to config file",
"docstring_tokens": [
"... |
b661328466a8d56969a18e1af128dd6c589d1058 | simeoncarstens/ensemble_hic | ensemble_hic/analysis_functions.py | [
"Unlicense",
"MIT"
] | Python | load_ensemble_from_pdb | <not_specific> | def load_ensemble_from_pdb(filename):
"""Loads a structure ensemble from a PDB file
:param filename: file name of PDB file
:type filename: str
:returns: atom coordinates of structure ensemble
:rtype: :class:`numpy.ndarray`
"""
if False:
## Insanely slow
from csb.bio.io.wwpd... | Loads a structure ensemble from a PDB file
:param filename: file name of PDB file
:type filename: str
:returns: atom coordinates of structure ensemble
:rtype: :class:`numpy.ndarray`
| Loads a structure ensemble from a PDB file | [
"Loads",
"a",
"structure",
"ensemble",
"from",
"a",
"PDB",
"file"
] | def load_ensemble_from_pdb(filename):
if False:
from csb.bio.io.wwpdb import StructureParser
ensemble = StructureParser(filename).parse_models()
return np.array([m.get_coordinates(['CA']) for m in ensemble])
else:
ip = open(filename)
lines = ip.readlines()
ip.clos... | [
"def",
"load_ensemble_from_pdb",
"(",
"filename",
")",
":",
"if",
"False",
":",
"from",
"csb",
".",
"bio",
".",
"io",
".",
"wwpdb",
"import",
"StructureParser",
"ensemble",
"=",
"StructureParser",
"(",
"filename",
")",
".",
"parse_models",
"(",
")",
"return"... | Loads a structure ensemble from a PDB file | [
"Loads",
"a",
"structure",
"ensemble",
"from",
"a",
"PDB",
"file"
] | [
"\"\"\"Loads a structure ensemble from a PDB file\n\n :param filename: file name of PDB file\n :type filename: str\n\n :returns: atom coordinates of structure ensemble\n :rtype: :class:`numpy.ndarray`\n \"\"\"",
"## Insanely slow",
"## Hacky"
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [
{
"docstring": "atom coordinates of structure ensemble",
"docstring_tokens": [
"atom",
"coordinates",
"of",
"structure",
"ensemble"
],
"type": ":class:`numpy.ndarray`"
}
],
"raises": [],
"params": [
{
"identifier": ... |
b661328466a8d56969a18e1af128dd6c589d1058 | simeoncarstens/ensemble_hic | ensemble_hic/analysis_functions.py | [
"Unlicense",
"MIT"
] | Python | calculate_DOS | <not_specific> | def calculate_DOS(config_file, n_samples, subsamples_fraction, burnin,
n_iter=100000, tol=1e-10, save_output=True, output_suffix=''):
"""Calculates the density of states (DOS) using non-parametric
histogram reweighting (WHAM).
:param config_file: Configuration file
:type config_file: ... | Calculates the density of states (DOS) using non-parametric
histogram reweighting (WHAM).
:param config_file: Configuration file
:type config_file: str
:param n_samples: number of samples the simulation ran
:type n_samples: int
:param subsamples_fraction: faction of samples (after burnin) to ... | Calculates the density of states (DOS) using non-parametric
histogram reweighting (WHAM). | [
"Calculates",
"the",
"density",
"of",
"states",
"(",
"DOS",
")",
"using",
"non",
"-",
"parametric",
"histogram",
"reweighting",
"(",
"WHAM",
")",
"."
] | def calculate_DOS(config_file, n_samples, subsamples_fraction, burnin,
n_iter=100000, tol=1e-10, save_output=True, output_suffix=''):
from ensemble_hic.wham import PyWHAM as WHAM, DOS
from ensemble_hic.setup_functions import parse_config_file, make_posterior
from ensemble_hic.analysis_func... | [
"def",
"calculate_DOS",
"(",
"config_file",
",",
"n_samples",
",",
"subsamples_fraction",
",",
"burnin",
",",
"n_iter",
"=",
"100000",
",",
"tol",
"=",
"1e-10",
",",
"save_output",
"=",
"True",
",",
"output_suffix",
"=",
"''",
")",
":",
"from",
"ensemble_hic... | Calculates the density of states (DOS) using non-parametric
histogram reweighting (WHAM). | [
"Calculates",
"the",
"density",
"of",
"states",
"(",
"DOS",
")",
"using",
"non",
"-",
"parametric",
"histogram",
"reweighting",
"(",
"WHAM",
")",
"."
] | [
"\"\"\"Calculates the density of states (DOS) using non-parametric\n histogram reweighting (WHAM).\n\n :param config_file: Configuration file\n :type config_file: str\n\n :param n_samples: number of samples the simulation ran\n :type n_samples: int\n\n :param subsamples_fraction: faction of sample... | [
{
"param": "config_file",
"type": null
},
{
"param": "n_samples",
"type": null
},
{
"param": "subsamples_fraction",
"type": null
},
{
"param": "burnin",
"type": null
},
{
"param": "n_iter",
"type": null
},
{
"param": "tol",
"type": null
},
{
... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "DOS"
}
],
"raises": [],
"params": [
{
"identifier": "config_file",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null... |
b661328466a8d56969a18e1af128dd6c589d1058 | simeoncarstens/ensemble_hic | ensemble_hic/analysis_functions.py | [
"Unlicense",
"MIT"
] | Python | calculate_evidence | <not_specific> | def calculate_evidence(dos):
"""Calculates the evidence from a DOS object
:param dos: DOS object (output from calculate_DOS)
:type dos: DOS
:returns: log-evidence (without additive constants stemming from likelihood
normalization)
:rtype: float
"""
from csb.numeric import... | Calculates the evidence from a DOS object
:param dos: DOS object (output from calculate_DOS)
:type dos: DOS
:returns: log-evidence (without additive constants stemming from likelihood
normalization)
:rtype: float
| Calculates the evidence from a DOS object | [
"Calculates",
"the",
"evidence",
"from",
"a",
"DOS",
"object"
] | def calculate_evidence(dos):
from csb.numeric import log_sum_exp
return log_sum_exp(-dos.E.sum(1) + dos.s) - \
log_sum_exp(-dos.E[:,1] + dos.s) | [
"def",
"calculate_evidence",
"(",
"dos",
")",
":",
"from",
"csb",
".",
"numeric",
"import",
"log_sum_exp",
"return",
"log_sum_exp",
"(",
"-",
"dos",
".",
"E",
".",
"sum",
"(",
"1",
")",
"+",
"dos",
".",
"s",
")",
"-",
"log_sum_exp",
"(",
"-",
"dos",
... | Calculates the evidence from a DOS object | [
"Calculates",
"the",
"evidence",
"from",
"a",
"DOS",
"object"
] | [
"\"\"\"Calculates the evidence from a DOS object\n\n :param dos: DOS object (output from calculate_DOS)\n :type dos: DOS\n :returns: log-evidence (without additive constants stemming from likelihood\n normalization)\n :rtype: float\n \"\"\""
] | [
{
"param": "dos",
"type": null
}
] | {
"returns": [
{
"docstring": "log-evidence (without additive constants stemming from likelihood\nnormalization)",
"docstring_tokens": [
"log",
"-",
"evidence",
"(",
"without",
"additive",
"constants",
"stemming",
"from",
... |
6f930be028b0200b19f12bf245f86e58961672cb | simeoncarstens/ensemble_hic | ensemble_hic/forcefields.py | [
"Unlicense",
"MIT"
] | Python | energy | null | def energy(self, structure):
"""
Evaluates the potentital energy of a structure
:param structure: coordinates of a structure
:type structure: :class:`numpy.ndarray`
:returns: potential energy of a structure
:rtype: float
"""
pass |
Evaluates the potentital energy of a structure
:param structure: coordinates of a structure
:type structure: :class:`numpy.ndarray`
:returns: potential energy of a structure
:rtype: float
| Evaluates the potentital energy of a structure | [
"Evaluates",
"the",
"potentital",
"energy",
"of",
"a",
"structure"
] | def energy(self, structure):
pass | [
"def",
"energy",
"(",
"self",
",",
"structure",
")",
":",
"pass"
] | Evaluates the potentital energy of a structure | [
"Evaluates",
"the",
"potentital",
"energy",
"of",
"a",
"structure"
] | [
"\"\"\"\n Evaluates the potentital energy of a structure\n\n :param structure: coordinates of a structure\n :type structure: :class:`numpy.ndarray`\n\n :returns: potential energy of a structure\n :rtype: float\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "structure",
"type": null
}
] | {
"returns": [
{
"docstring": "potential energy of a structure",
"docstring_tokens": [
"potential",
"energy",
"of",
"a",
"structure"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
... |
6f930be028b0200b19f12bf245f86e58961672cb | simeoncarstens/ensemble_hic | ensemble_hic/forcefields.py | [
"Unlicense",
"MIT"
] | Python | gradient | null | def gradient(self, structure):
"""
Evaluates the energy gradient for a structure
:param structure: coordinates of a structure
:type structure: :class:`numpy.ndarray`
:returns: gradient vector
:rtype: :class:`numpy.ndarray`
"""
pass |
Evaluates the energy gradient for a structure
:param structure: coordinates of a structure
:type structure: :class:`numpy.ndarray`
:returns: gradient vector
:rtype: :class:`numpy.ndarray`
| Evaluates the energy gradient for a structure | [
"Evaluates",
"the",
"energy",
"gradient",
"for",
"a",
"structure"
] | def gradient(self, structure):
pass | [
"def",
"gradient",
"(",
"self",
",",
"structure",
")",
":",
"pass"
] | Evaluates the energy gradient for a structure | [
"Evaluates",
"the",
"energy",
"gradient",
"for",
"a",
"structure"
] | [
"\"\"\"\n Evaluates the energy gradient for a structure\n\n :param structure: coordinates of a structure\n :type structure: :class:`numpy.ndarray`\n\n :returns: gradient vector\n :rtype: :class:`numpy.ndarray`\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "structure",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": ":class:`numpy.ndarray`"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"i... |
6f930be028b0200b19f12bf245f86e58961672cb | simeoncarstens/ensemble_hic | ensemble_hic/forcefields.py | [
"Unlicense",
"MIT"
] | Python | energy | <not_specific> | def energy(self, structure):
"""
Cython implementation of the potential energy
:param structure: coordinates of a structure
:type structure: :class:`numpy.ndarray`
:returns: potential energy of a structure
:rtype: float
"""
from ensemble_hic.forcefield_c... |
Cython implementation of the potential energy
:param structure: coordinates of a structure
:type structure: :class:`numpy.ndarray`
:returns: potential energy of a structure
:rtype: float
| Cython implementation of the potential energy | [
"Cython",
"implementation",
"of",
"the",
"potential",
"energy"
] | def energy(self, structure):
from ensemble_hic.forcefield_c import forcefield_energy
E = forcefield_energy(structure, self.bead_radii,
self.bead_radii2,
self.force_constant)
return E | [
"def",
"energy",
"(",
"self",
",",
"structure",
")",
":",
"from",
"ensemble_hic",
".",
"forcefield_c",
"import",
"forcefield_energy",
"E",
"=",
"forcefield_energy",
"(",
"structure",
",",
"self",
".",
"bead_radii",
",",
"self",
".",
"bead_radii2",
",",
"self",... | Cython implementation of the potential energy | [
"Cython",
"implementation",
"of",
"the",
"potential",
"energy"
] | [
"\"\"\"\n Cython implementation of the potential energy\n\n :param structure: coordinates of a structure\n :type structure: :class:`numpy.ndarray`\n\n :returns: potential energy of a structure\n :rtype: float\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "structure",
"type": null
}
] | {
"returns": [
{
"docstring": "potential energy of a structure",
"docstring_tokens": [
"potential",
"energy",
"of",
"a",
"structure"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
... |
6f930be028b0200b19f12bf245f86e58961672cb | simeoncarstens/ensemble_hic | ensemble_hic/forcefields.py | [
"Unlicense",
"MIT"
] | Python | gradient | <not_specific> | def gradient(self, structure):
"""
Cython implementation of the energy gradient
:param structure: coordinates of a structure
:type structure: :class:`numpy.ndarray`
:returns: gradient vector
:rtype: :class:`numpy.ndarray`
"""
from ensemble_hic.fo... |
Cython implementation of the energy gradient
:param structure: coordinates of a structure
:type structure: :class:`numpy.ndarray`
:returns: gradient vector
:rtype: :class:`numpy.ndarray`
| Cython implementation of the energy gradient | [
"Cython",
"implementation",
"of",
"the",
"energy",
"gradient"
] | def gradient(self, structure):
from ensemble_hic.forcefield_c import forcefield_gradient
grad = forcefield_gradient(structure, self.bead_radii,
self.bead_radii2,
self.force_constant)
return grad | [
"def",
"gradient",
"(",
"self",
",",
"structure",
")",
":",
"from",
"ensemble_hic",
".",
"forcefield_c",
"import",
"forcefield_gradient",
"grad",
"=",
"forcefield_gradient",
"(",
"structure",
",",
"self",
".",
"bead_radii",
",",
"self",
".",
"bead_radii2",
",",
... | Cython implementation of the energy gradient | [
"Cython",
"implementation",
"of",
"the",
"energy",
"gradient"
] | [
"\"\"\"\n Cython implementation of the energy gradient\n\n :param structure: coordinates of a structure\n :type structure: :class:`numpy.ndarray`\n\n :returns: gradient vector\n :rtype: :class:`numpy.ndarray`\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "structure",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": ":class:`numpy.ndarray`"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"i... |
71ecec5bb58b628560315f589ef8a5549774b0b7 | simeoncarstens/ensemble_hic | ensemble_hic/nblist.py | [
"Unlicense",
"MIT"
] | Python | cellsize | null | def cellsize():
"""
Edge length of the cubic cells.
"""
pass |
Edge length of the cubic cells.
| Edge length of the cubic cells. | [
"Edge",
"length",
"of",
"the",
"cubic",
"cells",
"."
] | def cellsize():
pass | [
"def",
"cellsize",
"(",
")",
":",
"pass"
] | Edge length of the cubic cells. | [
"Edge",
"length",
"of",
"the",
"cubic",
"cells",
"."
] | [
"\"\"\"\n Edge length of the cubic cells.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
71ecec5bb58b628560315f589ef8a5549774b0b7 | simeoncarstens/ensemble_hic | ensemble_hic/nblist.py | [
"Unlicense",
"MIT"
] | Python | n_cells | null | def n_cells():
"""
Number of cubic cells in each spatial direction such that the
total number of cells is 'n_cells^3'.
"""
pass |
Number of cubic cells in each spatial direction such that the
total number of cells is 'n_cells^3'.
| Number of cubic cells in each spatial direction such that the
total number of cells is 'n_cells^3'. | [
"Number",
"of",
"cubic",
"cells",
"in",
"each",
"spatial",
"direction",
"such",
"that",
"the",
"total",
"number",
"of",
"cells",
"is",
"'",
"n_cells^3",
"'",
"."
] | def n_cells():
pass | [
"def",
"n_cells",
"(",
")",
":",
"pass"
] | Number of cubic cells in each spatial direction such that the
total number of cells is 'n_cells^3'. | [
"Number",
"of",
"cubic",
"cells",
"in",
"each",
"spatial",
"direction",
"such",
"that",
"the",
"total",
"number",
"of",
"cells",
"is",
"'",
"n_cells^3",
"'",
"."
] | [
"\"\"\"\n Number of cubic cells in each spatial direction such that the\n total number of cells is 'n_cells^3'.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
71ecec5bb58b628560315f589ef8a5549774b0b7 | simeoncarstens/ensemble_hic | ensemble_hic/nblist.py | [
"Unlicense",
"MIT"
] | Python | n_per_cell | null | def n_per_cell():
"""
Maximum number of particles that fits into a cell.
"""
pass |
Maximum number of particles that fits into a cell.
| Maximum number of particles that fits into a cell. | [
"Maximum",
"number",
"of",
"particles",
"that",
"fits",
"into",
"a",
"cell",
"."
] | def n_per_cell():
pass | [
"def",
"n_per_cell",
"(",
")",
":",
"pass"
] | Maximum number of particles that fits into a cell. | [
"Maximum",
"number",
"of",
"particles",
"that",
"fits",
"into",
"a",
"cell",
"."
] | [
"\"\"\"\n Maximum number of particles that fits into a cell. \n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
71ecec5bb58b628560315f589ef8a5549774b0b7 | simeoncarstens/ensemble_hic | ensemble_hic/nblist.py | [
"Unlicense",
"MIT"
] | Python | update | null | def update(self, universe, update_box=True):
"""
Update the neighbor list.
Parameters
----------
universe :
Universe containing all particles whose pairwise interactions
will be evaluated.
update_box : boolean
By toggling the flag, we can ... |
Update the neighbor list.
Parameters
----------
universe :
Universe containing all particles whose pairwise interactions
will be evaluated.
update_box : boolean
By toggling the flag, we can switch off the adaption of the
cell grid (i.e.... | Update the neighbor list.
Parameters
universe :
Universe containing all particles whose pairwise interactions
will be evaluated.
update_box : boolean
By toggling the flag, we can switch off the adaption of the
cell grid | [
"Update",
"the",
"neighbor",
"list",
".",
"Parameters",
"universe",
":",
"Universe",
"containing",
"all",
"particles",
"whose",
"pairwise",
"interactions",
"will",
"be",
"evaluated",
".",
"update_box",
":",
"boolean",
"By",
"toggling",
"the",
"flag",
"we",
"can"... | def update(self, universe, update_box=True):
self.ctype.update(universe.coords, int(update_box)) | [
"def",
"update",
"(",
"self",
",",
"universe",
",",
"update_box",
"=",
"True",
")",
":",
"self",
".",
"ctype",
".",
"update",
"(",
"universe",
".",
"coords",
",",
"int",
"(",
"update_box",
")",
")"
] | Update the neighbor list. | [
"Update",
"the",
"neighbor",
"list",
"."
] | [
"\"\"\"\n Update the neighbor list.\n\n Parameters\n ----------\n\n universe :\n Universe containing all particles whose pairwise interactions\n will be evaluated.\n\n update_box : boolean\n By toggling the flag, we can switch off the adaption of the\n ... | [
{
"param": "self",
"type": null
},
{
"param": "universe",
"type": null
},
{
"param": "update_box",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "universe",
"type": null,
"docstring": null,
"docstring_tokens... |
c0e6fb6fdeb419f4456ff38cda990830605dba2c | simeoncarstens/ensemble_hic | data/nora2012/make_processed_files.py | [
"Unlicense",
"MIT"
] | Python | parse_5C_file | <not_specific> | def parse_5C_file(filename):
"""
Reads the raw 5C data file and returns reverse restriction fragments,
forward restriction fragments, and a matrix of shape
(# forward fragments + 2, # reverse fragments + 2).
First two rows are start / end genomic coordinates of reverse restriction
fragments, fir... |
Reads the raw 5C data file and returns reverse restriction fragments,
forward restriction fragments, and a matrix of shape
(# forward fragments + 2, # reverse fragments + 2).
First two rows are start / end genomic coordinates of reverse restriction
fragments, first two columns are start / end genom... | Reads the raw 5C data file and returns reverse restriction fragments,
forward restriction fragments, and a matrix of shape
(# forward fragments + 2, # reverse fragments + 2).
First two rows are start / end genomic coordinates of reverse restriction
fragments, first two columns are start / end genomic coordinates of for... | [
"Reads",
"the",
"raw",
"5C",
"data",
"file",
"and",
"returns",
"reverse",
"restriction",
"fragments",
"forward",
"restriction",
"fragments",
"and",
"a",
"matrix",
"of",
"shape",
"(",
"#",
"forward",
"fragments",
"+",
"2",
"#",
"reverse",
"fragments",
"+",
"2... | def parse_5C_file(filename):
data = open(filename).readlines()
data = data[7:]
data = [y.split('\t') for y in data]
data = np.array(data)
rev_fragments = [x[x.find('chrX:')+5:] for x in data[0]]
rev_fragments = [x.split('-') for x in rev_fragments]
rev_fragments = [(int(x[0]), int(x[1])) for... | [
"def",
"parse_5C_file",
"(",
"filename",
")",
":",
"data",
"=",
"open",
"(",
"filename",
")",
".",
"readlines",
"(",
")",
"data",
"=",
"data",
"[",
"7",
":",
"]",
"data",
"=",
"[",
"y",
".",
"split",
"(",
"'\\t'",
")",
"for",
"y",
"in",
"data",
... | Reads the raw 5C data file and returns reverse restriction fragments,
forward restriction fragments, and a matrix of shape
(# forward fragments + 2, # reverse fragments + 2). | [
"Reads",
"the",
"raw",
"5C",
"data",
"file",
"and",
"returns",
"reverse",
"restriction",
"fragments",
"forward",
"restriction",
"fragments",
"and",
"a",
"matrix",
"of",
"shape",
"(",
"#",
"forward",
"fragments",
"+",
"2",
"#",
"reverse",
"fragments",
"+",
"2... | [
"\"\"\"\n Reads the raw 5C data file and returns reverse restriction fragments,\n forward restriction fragments, and a matrix of shape\n (# forward fragments + 2, # reverse fragments + 2).\n First two rows are start / end genomic coordinates of reverse restriction\n fragments, first two columns are s... | [
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c0e6fb6fdeb419f4456ff38cda990830605dba2c | simeoncarstens/ensemble_hic | data/nora2012/make_processed_files.py | [
"Unlicense",
"MIT"
] | Python | extract_region | <not_specific> | def extract_region(matrix, region_start, region_end):
"""
Extracts a region from a matrix produced by parse_5C_file.
Returns the reverse and forward restriction fragments in the region
and the part of the matrix covered by the region
"""
land = np.logical_and
region_row_mask = land(matrix[:,... |
Extracts a region from a matrix produced by parse_5C_file.
Returns the reverse and forward restriction fragments in the region
and the part of the matrix covered by the region
| Extracts a region from a matrix produced by parse_5C_file.
Returns the reverse and forward restriction fragments in the region
and the part of the matrix covered by the region | [
"Extracts",
"a",
"region",
"from",
"a",
"matrix",
"produced",
"by",
"parse_5C_file",
".",
"Returns",
"the",
"reverse",
"and",
"forward",
"restriction",
"fragments",
"in",
"the",
"region",
"and",
"the",
"part",
"of",
"the",
"matrix",
"covered",
"by",
"the",
"... | def extract_region(matrix, region_start, region_end):
land = np.logical_and
region_row_mask = land(matrix[:,0] >= region_start, matrix[:,1] <= region_end)
region_col_mask = land(matrix[0,:] >= region_start, matrix[1,:] <= region_end)
region = matrix[region_row_mask]
region = region[:,region_col_mask... | [
"def",
"extract_region",
"(",
"matrix",
",",
"region_start",
",",
"region_end",
")",
":",
"land",
"=",
"np",
".",
"logical_and",
"region_row_mask",
"=",
"land",
"(",
"matrix",
"[",
":",
",",
"0",
"]",
">=",
"region_start",
",",
"matrix",
"[",
":",
",",
... | Extracts a region from a matrix produced by parse_5C_file. | [
"Extracts",
"a",
"region",
"from",
"a",
"matrix",
"produced",
"by",
"parse_5C_file",
"."
] | [
"\"\"\"\n Extracts a region from a matrix produced by parse_5C_file.\n Returns the reverse and forward restriction fragments in the region\n and the part of the matrix covered by the region\n \"\"\""
] | [
{
"param": "matrix",
"type": null
},
{
"param": "region_start",
"type": null
},
{
"param": "region_end",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "matrix",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "region_start",
"type": null,
"docstring": null,
"docstring_... |
c0e6fb6fdeb419f4456ff38cda990830605dba2c | simeoncarstens/ensemble_hic | data/nora2012/make_processed_files.py | [
"Unlicense",
"MIT"
] | Python | calculate_bead_lims | <not_specific> | def calculate_bead_lims(bead_size, region_revs, region_fors):
"""
Divides a region on a chromosome (or rather, the part of it covered by complete
restriction fragments) into segments of equal, given length and one last
segment which is smaller than the others such that the segments completely
cover ... |
Divides a region on a chromosome (or rather, the part of it covered by complete
restriction fragments) into segments of equal, given length and one last
segment which is smaller than the others such that the segments completely
cover the region. These segments will be represented by spherical beads lat... | Divides a region on a chromosome (or rather, the part of it covered by complete
restriction fragments) into segments of equal, given length and one last
segment which is smaller than the others such that the segments completely
cover the region. These segments will be represented by spherical beads later.
Returns the l... | [
"Divides",
"a",
"region",
"on",
"a",
"chromosome",
"(",
"or",
"rather",
"the",
"part",
"of",
"it",
"covered",
"by",
"complete",
"restriction",
"fragments",
")",
"into",
"segments",
"of",
"equal",
"given",
"length",
"and",
"one",
"last",
"segment",
"which",
... | def calculate_bead_lims(bead_size, region_revs, region_fors):
region_length = np.max((region_fors[-1,1], region_revs[1,-1])) \
- np.min((region_fors[0,0], region_revs[0,0]))
n_beads = int(round(region_length / bead_size)) + 1
bead_lims = [np.min((region_fors[0,0], region_revs[0,0])) + ... | [
"def",
"calculate_bead_lims",
"(",
"bead_size",
",",
"region_revs",
",",
"region_fors",
")",
":",
"region_length",
"=",
"np",
".",
"max",
"(",
"(",
"region_fors",
"[",
"-",
"1",
",",
"1",
"]",
",",
"region_revs",
"[",
"1",
",",
"-",
"1",
"]",
")",
")... | Divides a region on a chromosome (or rather, the part of it covered by complete
restriction fragments) into segments of equal, given length and one last
segment which is smaller than the others such that the segments completely
cover the region. | [
"Divides",
"a",
"region",
"on",
"a",
"chromosome",
"(",
"or",
"rather",
"the",
"part",
"of",
"it",
"covered",
"by",
"complete",
"restriction",
"fragments",
")",
"into",
"segments",
"of",
"equal",
"given",
"length",
"and",
"one",
"last",
"segment",
"which",
... | [
"\"\"\"\n Divides a region on a chromosome (or rather, the part of it covered by complete\n restriction fragments) into segments of equal, given length and one last\n segment which is smaller than the others such that the segments completely\n cover the region. These segments will be represented by sphe... | [
{
"param": "bead_size",
"type": null
},
{
"param": "region_revs",
"type": null
},
{
"param": "region_fors",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bead_size",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "region_revs",
"type": null,
"docstring": null,
"docstrin... |
c0e6fb6fdeb419f4456ff38cda990830605dba2c | simeoncarstens/ensemble_hic | data/nora2012/make_processed_files.py | [
"Unlicense",
"MIT"
] | Python | calculate_mappings | <not_specific> | def calculate_mappings(region_revs, region_fors, bead_lims):
"""
Calculates a mapping assigning a bead to each restriction fragment.
If one restriction fragment spans several beads, it will have the center
bead (or center - 1 for even number of beads) assigned.
Returns the mappings for reverse and f... |
Calculates a mapping assigning a bead to each restriction fragment.
If one restriction fragment spans several beads, it will have the center
bead (or center - 1 for even number of beads) assigned.
Returns the mappings for reverse and forward restriction fragments
| Calculates a mapping assigning a bead to each restriction fragment.
If one restriction fragment spans several beads, it will have the center
bead (or center - 1 for even number of beads) assigned.
Returns the mappings for reverse and forward restriction fragments | [
"Calculates",
"a",
"mapping",
"assigning",
"a",
"bead",
"to",
"each",
"restriction",
"fragment",
".",
"If",
"one",
"restriction",
"fragment",
"spans",
"several",
"beads",
"it",
"will",
"have",
"the",
"center",
"bead",
"(",
"or",
"center",
"-",
"1",
"for",
... | def calculate_mappings(region_revs, region_fors, bead_lims):
region_revs = region_revs.T
mappings = []
for rfs in (region_revs, region_fors):
mapping = []
for b, e in rfs:
mapping.append((np.where(bead_lims <= b)[0][-1],
np.where(bead_lims <= e)[0]... | [
"def",
"calculate_mappings",
"(",
"region_revs",
",",
"region_fors",
",",
"bead_lims",
")",
":",
"region_revs",
"=",
"region_revs",
".",
"T",
"mappings",
"=",
"[",
"]",
"for",
"rfs",
"in",
"(",
"region_revs",
",",
"region_fors",
")",
":",
"mapping",
"=",
"... | Calculates a mapping assigning a bead to each restriction fragment. | [
"Calculates",
"a",
"mapping",
"assigning",
"a",
"bead",
"to",
"each",
"restriction",
"fragment",
"."
] | [
"\"\"\"\n Calculates a mapping assigning a bead to each restriction fragment.\n If one restriction fragment spans several beads, it will have the center\n bead (or center - 1 for even number of beads) assigned.\n Returns the mappings for reverse and forward restriction fragments\n \"\"\""
] | [
{
"param": "region_revs",
"type": null
},
{
"param": "region_fors",
"type": null
},
{
"param": "bead_lims",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "region_revs",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "region_fors",
"type": null,
"docstring": null,
"docstr... |
c0e6fb6fdeb419f4456ff38cda990830605dba2c | simeoncarstens/ensemble_hic | data/nora2012/make_processed_files.py | [
"Unlicense",
"MIT"
] | Python | build_cmatrix | <not_specific> | def build_cmatrix(rev_mapping, for_mapping, region, n_beads):
"""
Builds a square contact frequency matrix of shape (n_beads, n_beads).
Contacts from restriction fragments mapping to the same bead are summed.
A zero in this matrix means either that there was no data collected or that
the number of c... |
Builds a square contact frequency matrix of shape (n_beads, n_beads).
Contacts from restriction fragments mapping to the same bead are summed.
A zero in this matrix means either that there was no data collected or that
the number of counts is in fact zero. Later, we ignore zero-valued
entries in th... | Builds a square contact frequency matrix of shape (n_beads, n_beads).
Contacts from restriction fragments mapping to the same bead are summed.
A zero in this matrix means either that there was no data collected or that
the number of counts is in fact zero. Later, we ignore zero-valued
entries in the matrix.
Return squa... | [
"Builds",
"a",
"square",
"contact",
"frequency",
"matrix",
"of",
"shape",
"(",
"n_beads",
"n_beads",
")",
".",
"Contacts",
"from",
"restriction",
"fragments",
"mapping",
"to",
"the",
"same",
"bead",
"are",
"summed",
".",
"A",
"zero",
"in",
"this",
"matrix",
... | def build_cmatrix(rev_mapping, for_mapping, region, n_beads):
contmatrix = np.zeros((n_beads, n_beads))
cmatrix = np.zeros((n_beads, n_beads))
for i in range(n_beads):
contributing_fors = np.where(for_mapping == i)[0]
for j in range(n_beads):
contributing_revs = np.where(rev_mapp... | [
"def",
"build_cmatrix",
"(",
"rev_mapping",
",",
"for_mapping",
",",
"region",
",",
"n_beads",
")",
":",
"contmatrix",
"=",
"np",
".",
"zeros",
"(",
"(",
"n_beads",
",",
"n_beads",
")",
")",
"cmatrix",
"=",
"np",
".",
"zeros",
"(",
"(",
"n_beads",
",",... | Builds a square contact frequency matrix of shape (n_beads, n_beads). | [
"Builds",
"a",
"square",
"contact",
"frequency",
"matrix",
"of",
"shape",
"(",
"n_beads",
"n_beads",
")",
"."
] | [
"\"\"\"\n Builds a square contact frequency matrix of shape (n_beads, n_beads).\n Contacts from restriction fragments mapping to the same bead are summed.\n A zero in this matrix means either that there was no data collected or that\n the number of counts is in fact zero. Later, we ignore zero-valued\n ... | [
{
"param": "rev_mapping",
"type": null
},
{
"param": "for_mapping",
"type": null
},
{
"param": "region",
"type": null
},
{
"param": "n_beads",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rev_mapping",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "for_mapping",
"type": null,
"docstring": null,
"docstr... |
c0e6fb6fdeb419f4456ff38cda990830605dba2c | simeoncarstens/ensemble_hic | data/nora2012/make_processed_files.py | [
"Unlicense",
"MIT"
] | Python | write_cmatrix | null | def write_cmatrix(cmatrix, filename):
"""
Writes a square contact frequency matrix to a file, which will be the
input for our structure calculation code.
"""
with open(filename, 'w') as opf:
for i in range(len(cmatrix)):
for j in range(i+1, len(cmatrix)):
opf.writ... |
Writes a square contact frequency matrix to a file, which will be the
input for our structure calculation code.
| Writes a square contact frequency matrix to a file, which will be the
input for our structure calculation code. | [
"Writes",
"a",
"square",
"contact",
"frequency",
"matrix",
"to",
"a",
"file",
"which",
"will",
"be",
"the",
"input",
"for",
"our",
"structure",
"calculation",
"code",
"."
] | def write_cmatrix(cmatrix, filename):
with open(filename, 'w') as opf:
for i in range(len(cmatrix)):
for j in range(i+1, len(cmatrix)):
opf.write('{}\t{}\t{}\n'.format(i, j, int(cmatrix[i,j]))) | [
"def",
"write_cmatrix",
"(",
"cmatrix",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'w'",
")",
"as",
"opf",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"cmatrix",
")",
")",
":",
"for",
"j",
"in",
"range",
"(",
"i",
"+",... | Writes a square contact frequency matrix to a file, which will be the
input for our structure calculation code. | [
"Writes",
"a",
"square",
"contact",
"frequency",
"matrix",
"to",
"a",
"file",
"which",
"will",
"be",
"the",
"input",
"for",
"our",
"structure",
"calculation",
"code",
"."
] | [
"\"\"\"\n Writes a square contact frequency matrix to a file, which will be the\n input for our structure calculation code.\n \"\"\""
] | [
{
"param": "cmatrix",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cmatrix",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tok... |
3e14ec227451c537d6b85079d3c368bb0f878886 | simeoncarstens/ensemble_hic | ensemble_hic/npsamplers.py | [
"Unlicense",
"MIT"
] | Python | _calculate_shape | null | def _calculate_shape(self):
"""
Calculates the shape of the Gamma distribution
:returns: shape of Gamma distribution
:rtype: float > 0
"""
pass |
Calculates the shape of the Gamma distribution
:returns: shape of Gamma distribution
:rtype: float > 0
| Calculates the shape of the Gamma distribution | [
"Calculates",
"the",
"shape",
"of",
"the",
"Gamma",
"distribution"
] | def _calculate_shape(self):
pass | [
"def",
"_calculate_shape",
"(",
"self",
")",
":",
"pass"
] | Calculates the shape of the Gamma distribution | [
"Calculates",
"the",
"shape",
"of",
"the",
"Gamma",
"distribution"
] | [
"\"\"\"\n Calculates the shape of the Gamma distribution\n\n :returns: shape of Gamma distribution\n :rtype: float > 0\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "shape of Gamma distribution",
"docstring_tokens": [
"shape",
"of",
"Gamma",
"distribution"
],
"type": "float > 0"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring":... |
3e14ec227451c537d6b85079d3c368bb0f878886 | simeoncarstens/ensemble_hic | ensemble_hic/npsamplers.py | [
"Unlicense",
"MIT"
] | Python | _calculate_rate | null | def _calculate_rate(self):
"""
Calculates the rate of the Gamma distribution
:returns: rate of Gamma distribution
:rtype: float > 0
"""
pass |
Calculates the rate of the Gamma distribution
:returns: rate of Gamma distribution
:rtype: float > 0
| Calculates the rate of the Gamma distribution | [
"Calculates",
"the",
"rate",
"of",
"the",
"Gamma",
"distribution"
] | def _calculate_rate(self):
pass | [
"def",
"_calculate_rate",
"(",
"self",
")",
":",
"pass"
] | Calculates the rate of the Gamma distribution | [
"Calculates",
"the",
"rate",
"of",
"the",
"Gamma",
"distribution"
] | [
"\"\"\"\n Calculates the rate of the Gamma distribution\n\n :returns: rate of Gamma distribution\n :rtype: float > 0\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "rate of Gamma distribution",
"docstring_tokens": [
"rate",
"of",
"Gamma",
"distribution"
],
"type": "float > 0"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": n... |
3e14ec227451c537d6b85079d3c368bb0f878886 | simeoncarstens/ensemble_hic | ensemble_hic/npsamplers.py | [
"Unlicense",
"MIT"
] | Python | sample | <not_specific> | def sample(self, state=42):
"""
Draws a sample from the Gamma distribution specified
by a rate and a scale parameter
:returns: a sample
:rtype: float
"""
rate = self._calculate_rate()
shape = self._calculate_shape()
sample = np.random.gamm... |
Draws a sample from the Gamma distribution specified
by a rate and a scale parameter
:returns: a sample
:rtype: float
| Draws a sample from the Gamma distribution specified
by a rate and a scale parameter | [
"Draws",
"a",
"sample",
"from",
"the",
"Gamma",
"distribution",
"specified",
"by",
"a",
"rate",
"and",
"a",
"scale",
"parameter"
] | def sample(self, state=42):
rate = self._calculate_rate()
shape = self._calculate_shape()
sample = np.random.gamma(shape) / rate
if sample == 0.0:
sample += 1e-10
self.state = sample
return self.state | [
"def",
"sample",
"(",
"self",
",",
"state",
"=",
"42",
")",
":",
"rate",
"=",
"self",
".",
"_calculate_rate",
"(",
")",
"shape",
"=",
"self",
".",
"_calculate_shape",
"(",
")",
"sample",
"=",
"np",
".",
"random",
".",
"gamma",
"(",
"shape",
")",
"/... | Draws a sample from the Gamma distribution specified
by a rate and a scale parameter | [
"Draws",
"a",
"sample",
"from",
"the",
"Gamma",
"distribution",
"specified",
"by",
"a",
"rate",
"and",
"a",
"scale",
"parameter"
] | [
"\"\"\"\n Draws a sample from the Gamma distribution specified\n by a rate and a scale parameter\n\n :returns: a sample\n :rtype: float\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "state",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null... |
3e14ec227451c537d6b85079d3c368bb0f878886 | simeoncarstens/ensemble_hic | ensemble_hic/npsamplers.py | [
"Unlicense",
"MIT"
] | Python | _get_prior | <not_specific> | def _get_prior(self):
"""
Retrieves the prior distribution object associated with the
scaling factor variable
:returns: prior distribution object
:rtype: :class:`.NormGammaPrior`
"""
prior = filter(lambda p: 'norm' in p.variables, self.pdf.priors.values())[0]
... |
Retrieves the prior distribution object associated with the
scaling factor variable
:returns: prior distribution object
:rtype: :class:`.NormGammaPrior`
| Retrieves the prior distribution object associated with the
scaling factor variable | [
"Retrieves",
"the",
"prior",
"distribution",
"object",
"associated",
"with",
"the",
"scaling",
"factor",
"variable"
] | def _get_prior(self):
prior = filter(lambda p: 'norm' in p.variables, self.pdf.priors.values())[0]
return prior | [
"def",
"_get_prior",
"(",
"self",
")",
":",
"prior",
"=",
"filter",
"(",
"lambda",
"p",
":",
"'norm'",
"in",
"p",
".",
"variables",
",",
"self",
".",
"pdf",
".",
"priors",
".",
"values",
"(",
")",
")",
"[",
"0",
"]",
"return",
"prior"
] | Retrieves the prior distribution object associated with the
scaling factor variable | [
"Retrieves",
"the",
"prior",
"distribution",
"object",
"associated",
"with",
"the",
"scaling",
"factor",
"variable"
] | [
"\"\"\"\n Retrieves the prior distribution object associated with the\n scaling factor variable\n\n :returns: prior distribution object\n :rtype: :class:`.NormGammaPrior`\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "prior distribution object",
"docstring_tokens": [
"prior",
"distribution",
"object"
],
"type": ":class:`.NormGammaPrior`"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring":... |
3e14ec227451c537d6b85079d3c368bb0f878886 | simeoncarstens/ensemble_hic | ensemble_hic/npsamplers.py | [
"Unlicense",
"MIT"
] | Python | _check_gamma_prior | <not_specific> | def _check_gamma_prior(self, prior):
"""
Checks whether retrieved prior distribution is in fact a Gamma
distribution
:param prior: a prior distribution object
:type prior: :class:`binf.pdf.priors.AbstractPrior`
:returns: isn't this self-documenting??
:rtype: boo... |
Checks whether retrieved prior distribution is in fact a Gamma
distribution
:param prior: a prior distribution object
:type prior: :class:`binf.pdf.priors.AbstractPrior`
:returns: isn't this self-documenting??
:rtype: bool
| Checks whether retrieved prior distribution is in fact a Gamma
distribution | [
"Checks",
"whether",
"retrieved",
"prior",
"distribution",
"is",
"in",
"fact",
"a",
"Gamma",
"distribution"
] | def _check_gamma_prior(self, prior):
from .gamma_prior import GammaPrior
return isinstance(prior, GammaPrior) | [
"def",
"_check_gamma_prior",
"(",
"self",
",",
"prior",
")",
":",
"from",
".",
"gamma_prior",
"import",
"GammaPrior",
"return",
"isinstance",
"(",
"prior",
",",
"GammaPrior",
")"
] | Checks whether retrieved prior distribution is in fact a Gamma
distribution | [
"Checks",
"whether",
"retrieved",
"prior",
"distribution",
"is",
"in",
"fact",
"a",
"Gamma",
"distribution"
] | [
"\"\"\"\n Checks whether retrieved prior distribution is in fact a Gamma\n distribution\n\n :param prior: a prior distribution object\n :type prior: :class:`binf.pdf.priors.AbstractPrior`\n\n :returns: isn't this self-documenting??\n :rtype: bool\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "prior",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "bool"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
6851afd593e7fd26e8097ce8f62d3135acfdb5c0 | simeoncarstens/ensemble_hic | ensemble_hic/setup_functions.py | [
"Unlicense",
"MIT"
] | Python | parse_config_file | <not_specific> | def parse_config_file(config_file):
"""
Parses a config file consisting of several sections.
I think I adapted this from the ConfigParser docs.
:param config_file: config file name
:type config_file: str
:returns: a nested dictionary with sections and section content
:rtype: dict of dicts
... |
Parses a config file consisting of several sections.
I think I adapted this from the ConfigParser docs.
:param config_file: config file name
:type config_file: str
:returns: a nested dictionary with sections and section content
:rtype: dict of dicts
| Parses a config file consisting of several sections.
I think I adapted this from the ConfigParser docs. | [
"Parses",
"a",
"config",
"file",
"consisting",
"of",
"several",
"sections",
".",
"I",
"think",
"I",
"adapted",
"this",
"from",
"the",
"ConfigParser",
"docs",
"."
] | def parse_config_file(config_file):
import ConfigParser
config = ConfigParser.ConfigParser()
config.read(config_file)
def config_section_map(section):
dict1 = {}
options = config.options(section)
for option in options:
try:
dict1[option] = config.get(s... | [
"def",
"parse_config_file",
"(",
"config_file",
")",
":",
"import",
"ConfigParser",
"config",
"=",
"ConfigParser",
".",
"ConfigParser",
"(",
")",
"config",
".",
"read",
"(",
"config_file",
")",
"def",
"config_section_map",
"(",
"section",
")",
":",
"dict1",
"=... | Parses a config file consisting of several sections. | [
"Parses",
"a",
"config",
"file",
"consisting",
"of",
"several",
"sections",
"."
] | [
"\"\"\"\n Parses a config file consisting of several sections.\n I think I adapted this from the ConfigParser docs.\n\n :param config_file: config file name\n :type config_file: str\n\n :returns: a nested dictionary with sections and section content\n :rtype: dict of dicts\n \"\"\""
] | [
{
"param": "config_file",
"type": null
}
] | {
"returns": [
{
"docstring": "a nested dictionary with sections and section content",
"docstring_tokens": [
"a",
"nested",
"dictionary",
"with",
"sections",
"and",
"section",
"content"
],
"type": "dict of dicts"
}
],
... |
6851afd593e7fd26e8097ce8f62d3135acfdb5c0 | simeoncarstens/ensemble_hic | ensemble_hic/setup_functions.py | [
"Unlicense",
"MIT"
] | Python | make_norm_prior | <not_specific> | def make_norm_prior(norm_prior_settings, likelihood, n_structures):
"""
Makes the Gamma prior object for the scaling parameter
Shape and rate of the Gamma distribution are set to rather broad
values depending on the average number of counts in the data
:param norm_prior_settings: settings for the ... |
Makes the Gamma prior object for the scaling parameter
Shape and rate of the Gamma distribution are set to rather broad
values depending on the average number of counts in the data
:param norm_prior_settings: settings for the scaling factor prior
as specified in a conf... | Makes the Gamma prior object for the scaling parameter
Shape and rate of the Gamma distribution are set to rather broad
values depending on the average number of counts in the data | [
"Makes",
"the",
"Gamma",
"prior",
"object",
"for",
"the",
"scaling",
"parameter",
"Shape",
"and",
"rate",
"of",
"the",
"Gamma",
"distribution",
"are",
"set",
"to",
"rather",
"broad",
"values",
"depending",
"on",
"the",
"average",
"number",
"of",
"counts",
"i... | def make_norm_prior(norm_prior_settings, likelihood, n_structures):
from .gamma_prior import NormGammaPrior
shape = norm_prior_settings['shape']
rate = norm_prior_settings['rate']
if shape == rate == 'auto':
rate = 1.0 / n_structures
dp = likelihood.forward_model.data_points[:,2]
... | [
"def",
"make_norm_prior",
"(",
"norm_prior_settings",
",",
"likelihood",
",",
"n_structures",
")",
":",
"from",
".",
"gamma_prior",
"import",
"NormGammaPrior",
"shape",
"=",
"norm_prior_settings",
"[",
"'shape'",
"]",
"rate",
"=",
"norm_prior_settings",
"[",
"'rate'... | Makes the Gamma prior object for the scaling parameter
Shape and rate of the Gamma distribution are set to rather broad
values depending on the average number of counts in the data | [
"Makes",
"the",
"Gamma",
"prior",
"object",
"for",
"the",
"scaling",
"parameter",
"Shape",
"and",
"rate",
"of",
"the",
"Gamma",
"distribution",
"are",
"set",
"to",
"rather",
"broad",
"values",
"depending",
"on",
"the",
"average",
"number",
"of",
"counts",
"i... | [
"\"\"\"\n Makes the Gamma prior object for the scaling parameter\n\n Shape and rate of the Gamma distribution are set to rather broad\n values depending on the average number of counts in the data\n\n :param norm_prior_settings: settings for the scaling factor prior\n as s... | [
{
"param": "norm_prior_settings",
"type": null
},
{
"param": "likelihood",
"type": null
},
{
"param": "n_structures",
"type": null
}
] | {
"returns": [
{
"docstring": "a scaling factor prior object",
"docstring_tokens": [
"a",
"scaling",
"factor",
"prior",
"object"
],
"type": ":class:`.NormGammaPrior`"
}
],
"raises": [],
"params": [
{
"identifier": "norm_prior_sett... |
6851afd593e7fd26e8097ce8f62d3135acfdb5c0 | simeoncarstens/ensemble_hic | ensemble_hic/setup_functions.py | [
"Unlicense",
"MIT"
] | Python | expspace | <not_specific> | def expspace(min, max, a, N):
"""
Helper function which creates an array of exponentially spaced values
I use this to create temperature schedules for
replica exchange simulations.
:param min: minimum value
:type min: float
:param max: maximum value
:type max: float
:param a... |
Helper function which creates an array of exponentially spaced values
I use this to create temperature schedules for
replica exchange simulations.
:param min: minimum value
:type min: float
:param max: maximum value
:type max: float
:param a: rate parameter
:type a: float
... | Helper function which creates an array of exponentially spaced values
I use this to create temperature schedules for
replica exchange simulations. | [
"Helper",
"function",
"which",
"creates",
"an",
"array",
"of",
"exponentially",
"spaced",
"values",
"I",
"use",
"this",
"to",
"create",
"temperature",
"schedules",
"for",
"replica",
"exchange",
"simulations",
"."
] | def expspace(min, max, a, N):
g = lambda n: (max - min) / (np.exp(a*(N-1.0)) - 1.0) * (np.exp(a*(n-1.0)) - 1.0) + float(min)
return np.array(map(g, np.arange(1, N+1))) | [
"def",
"expspace",
"(",
"min",
",",
"max",
",",
"a",
",",
"N",
")",
":",
"g",
"=",
"lambda",
"n",
":",
"(",
"max",
"-",
"min",
")",
"/",
"(",
"np",
".",
"exp",
"(",
"a",
"*",
"(",
"N",
"-",
"1.0",
")",
")",
"-",
"1.0",
")",
"*",
"(",
... | Helper function which creates an array of exponentially spaced values
I use this to create temperature schedules for
replica exchange simulations. | [
"Helper",
"function",
"which",
"creates",
"an",
"array",
"of",
"exponentially",
"spaced",
"values",
"I",
"use",
"this",
"to",
"create",
"temperature",
"schedules",
"for",
"replica",
"exchange",
"simulations",
"."
] | [
"\"\"\"\n Helper function which creates an array of exponentially spaced values\n\n I use this to create temperature schedules for \n replica exchange simulations.\n \n :param min: minimum value\n :type min: float\n\n :param max: maximum value\n :type max: float\n\n :param a: rate paramet... | [
{
"param": "min",
"type": null
},
{
"param": "max",
"type": null
},
{
"param": "a",
"type": null
},
{
"param": "N",
"type": null
}
] | {
"returns": [
{
"docstring": "array of exponentially spaced numbers",
"docstring_tokens": [
"array",
"of",
"exponentially",
"spaced",
"numbers"
],
"type": ":class:`numpy.ndarray`"
}
],
"raises": [],
"params": [
{
"identifier": "m... |
6851afd593e7fd26e8097ce8f62d3135acfdb5c0 | simeoncarstens/ensemble_hic | ensemble_hic/setup_functions.py | [
"Unlicense",
"MIT"
] | Python | make_replica_schedule | <not_specific> | def make_replica_schedule(replica_params, n_replicas):
"""
Makes a replica exchange schedule from settings specified in
a config file.
You can either have a linear or an exponential schedule
and a separate prior annealing chain or not. You can also
load a schedule from a Python pickle. It has t... |
Makes a replica exchange schedule from settings specified in
a config file.
You can either have a linear or an exponential schedule
and a separate prior annealing chain or not. You can also
load a schedule from a Python pickle. It has to be a
dict with the keys being the tempered parameters an... | Makes a replica exchange schedule from settings specified in
a config file.
You can either have a linear or an exponential schedule
and a separate prior annealing chain or not. You can also
load a schedule from a Python pickle. It has to be a
dict with the keys being the tempered parameters and the
values the schedule... | [
"Makes",
"a",
"replica",
"exchange",
"schedule",
"from",
"settings",
"specified",
"in",
"a",
"config",
"file",
".",
"You",
"can",
"either",
"have",
"a",
"linear",
"or",
"an",
"exponential",
"schedule",
"and",
"a",
"separate",
"prior",
"annealing",
"chain",
"... | def make_replica_schedule(replica_params, n_replicas):
l_min = float(replica_params['lambda_min'])
l_max = float(replica_params['lambda_max'])
b_min = float(replica_params['beta_min'])
b_max = float(replica_params['beta_max'])
if replica_params['schedule'] == 'linear':
if replica_params['sep... | [
"def",
"make_replica_schedule",
"(",
"replica_params",
",",
"n_replicas",
")",
":",
"l_min",
"=",
"float",
"(",
"replica_params",
"[",
"'lambda_min'",
"]",
")",
"l_max",
"=",
"float",
"(",
"replica_params",
"[",
"'lambda_max'",
"]",
")",
"b_min",
"=",
"float",... | Makes a replica exchange schedule from settings specified in
a config file. | [
"Makes",
"a",
"replica",
"exchange",
"schedule",
"from",
"settings",
"specified",
"in",
"a",
"config",
"file",
"."
] | [
"\"\"\"\n Makes a replica exchange schedule from settings specified in\n a config file.\n\n You can either have a linear or an exponential schedule\n and a separate prior annealing chain or not. You can also\n load a schedule from a Python pickle. It has to be a\n dict with the keys being the temp... | [
{
"param": "replica_params",
"type": null
},
{
"param": "n_replicas",
"type": null
}
] | {
"returns": [
{
"docstring": "a replica exchange schedule",
"docstring_tokens": [
"a",
"replica",
"exchange",
"schedule"
],
"type": "dict, e.g., {'beta': np.array([0, 0.33, 0.66, 1.0])}"
}
],
"raises": [],
"params": [
{
"identifier": "re... |
6851afd593e7fd26e8097ce8f62d3135acfdb5c0 | simeoncarstens/ensemble_hic | ensemble_hic/setup_functions.py | [
"Unlicense",
"MIT"
] | Python | make_subsamplers | <not_specific> | def make_subsamplers(posterior, initial_state,
structures_hmc_params):
"""
Makes a dictionary of (possibly MCMC) samplers for all variables
:param posterior: posterior distribution you want to sample
:type posterior: :class:`binf.pdf.posteriors.Posterior
:param initial_state: ... |
Makes a dictionary of (possibly MCMC) samplers for all variables
:param posterior: posterior distribution you want to sample
:type posterior: :class:`binf.pdf.posteriors.Posterior
:param initial_state: intial state
:type initial_state: :class:`binf.samplers.BinfState`
:param structures_hmc_p... | Makes a dictionary of (possibly MCMC) samplers for all variables | [
"Makes",
"a",
"dictionary",
"of",
"(",
"possibly",
"MCMC",
")",
"samplers",
"for",
"all",
"variables"
] | def make_subsamplers(posterior, initial_state,
structures_hmc_params):
from binf.samplers.hmc import HMCSampler
p = posterior
variables = initial_state.keys()
structures_tl = int(structures_hmc_params['trajectory_length'])
structures_timestep = float(structures_hmc_params['times... | [
"def",
"make_subsamplers",
"(",
"posterior",
",",
"initial_state",
",",
"structures_hmc_params",
")",
":",
"from",
"binf",
".",
"samplers",
".",
"hmc",
"import",
"HMCSampler",
"p",
"=",
"posterior",
"variables",
"=",
"initial_state",
".",
"keys",
"(",
")",
"st... | Makes a dictionary of (possibly MCMC) samplers for all variables | [
"Makes",
"a",
"dictionary",
"of",
"(",
"possibly",
"MCMC",
")",
"samplers",
"for",
"all",
"variables"
] | [
"\"\"\"\n Makes a dictionary of (possibly MCMC) samplers for all variables\n\n :param posterior: posterior distribution you want to sample\n :type posterior: :class:`binf.pdf.posteriors.Posterior\n\n :param initial_state: intial state\n :type initial_state: :class:`binf.samplers.BinfState`\n\n :pa... | [
{
"param": "posterior",
"type": null
},
{
"param": "initial_state",
"type": null
},
{
"param": "structures_hmc_params",
"type": null
}
] | {
"returns": [
{
"docstring": "a dictionary with the keys being the variables and\nthe values the corresponding samplers over which\na Gibbs sampler eventually will iterate",
"docstring_tokens": [
"a",
"dictionary",
"with",
"the",
"keys",
"being",
... |
6851afd593e7fd26e8097ce8f62d3135acfdb5c0 | simeoncarstens/ensemble_hic | ensemble_hic/setup_functions.py | [
"Unlicense",
"MIT"
] | Python | make_elongated_structures | <not_specific> | def make_elongated_structures(bead_radii, n_structures):
"""
Makes a set of fully elongated structures
:param bead_radii: bead radii for each bead
:type bead_radii: :class:`numpy.ndarray`
:param n_structures: number of ensemble members
:type n_structures: int
:returns: a population of... |
Makes a set of fully elongated structures
:param bead_radii: bead radii for each bead
:type bead_radii: :class:`numpy.ndarray`
:param n_structures: number of ensemble members
:type n_structures: int
:returns: a population of fully elongated structures
:rtype: :class:`numpy.ndarray`
... | Makes a set of fully elongated structures | [
"Makes",
"a",
"set",
"of",
"fully",
"elongated",
"structures"
] | def make_elongated_structures(bead_radii, n_structures):
X = [bead_radii[0]]
for i in range(len(bead_radii) -1):
X.append(X[-1] + bead_radii[i+1] + bead_radii[i])
X = np.array(X) - np.mean(X)
X = np.array([X, np.zeros(len(bead_radii)),
np.zeros(len(bead_radii))]).T[None,:]
... | [
"def",
"make_elongated_structures",
"(",
"bead_radii",
",",
"n_structures",
")",
":",
"X",
"=",
"[",
"bead_radii",
"[",
"0",
"]",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"bead_radii",
")",
"-",
"1",
")",
":",
"X",
".",
"append",
"(",
"X",
... | Makes a set of fully elongated structures | [
"Makes",
"a",
"set",
"of",
"fully",
"elongated",
"structures"
] | [
"\"\"\"\n Makes a set of fully elongated structures\n\n :param bead_radii: bead radii for each bead\n :type bead_radii: :class:`numpy.ndarray`\n\n :param n_structures: number of ensemble members\n :type n_structures: int\n \n :returns: a population of fully elongated structures\n :rtype: :cl... | [
{
"param": "bead_radii",
"type": null
},
{
"param": "n_structures",
"type": null
}
] | {
"returns": [
{
"docstring": "a population of fully elongated structures",
"docstring_tokens": [
"a",
"population",
"of",
"fully",
"elongated",
"structures"
],
"type": ":class:`numpy.ndarray`"
}
],
"raises": [],
"params": [
{
... |
6851afd593e7fd26e8097ce8f62d3135acfdb5c0 | simeoncarstens/ensemble_hic | ensemble_hic/setup_functions.py | [
"Unlicense",
"MIT"
] | Python | make_random_structures | <not_specific> | def make_random_structures(bead_radii, n_structures):
"""
Makes a set of random structures with bead positions drawn
from a normal distribution
:param bead_radii: bead radii for each bead
:type bead_radii: :class:`numpy.ndarray`
:param n_structures: number of ensemble members
:type n_struc... |
Makes a set of random structures with bead positions drawn
from a normal distribution
:param bead_radii: bead radii for each bead
:type bead_radii: :class:`numpy.ndarray`
:param n_structures: number of ensemble members
:type n_structures: int
:returns: a population of random structures
... | Makes a set of random structures with bead positions drawn
from a normal distribution | [
"Makes",
"a",
"set",
"of",
"random",
"structures",
"with",
"bead",
"positions",
"drawn",
"from",
"a",
"normal",
"distribution"
] | def make_random_structures(bead_radii, n_structures):
d = bead_radii.mean() * len(bead_radii) ** 0.333
X = np.random.normal(scale=d, size=(n_structures, len(bead_radii), 3))
return X.ravel() | [
"def",
"make_random_structures",
"(",
"bead_radii",
",",
"n_structures",
")",
":",
"d",
"=",
"bead_radii",
".",
"mean",
"(",
")",
"*",
"len",
"(",
"bead_radii",
")",
"**",
"0.333",
"X",
"=",
"np",
".",
"random",
".",
"normal",
"(",
"scale",
"=",
"d",
... | Makes a set of random structures with bead positions drawn
from a normal distribution | [
"Makes",
"a",
"set",
"of",
"random",
"structures",
"with",
"bead",
"positions",
"drawn",
"from",
"a",
"normal",
"distribution"
] | [
"\"\"\"\n Makes a set of random structures with bead positions drawn\n from a normal distribution\n\n :param bead_radii: bead radii for each bead\n :type bead_radii: :class:`numpy.ndarray`\n\n :param n_structures: number of ensemble members\n :type n_structures: int\n\n :returns: a population o... | [
{
"param": "bead_radii",
"type": null
},
{
"param": "n_structures",
"type": null
}
] | {
"returns": [
{
"docstring": "a population of random structures",
"docstring_tokens": [
"a",
"population",
"of",
"random",
"structures"
],
"type": ":class:`numpy.ndarray`"
}
],
"raises": [],
"params": [
{
"identifier": "bead_radi... |
6851afd593e7fd26e8097ce8f62d3135acfdb5c0 | simeoncarstens/ensemble_hic | ensemble_hic/setup_functions.py | [
"Unlicense",
"MIT"
] | Python | make_conditional_posterior | <not_specific> | def make_conditional_posterior(posterior, settings):
"""
Conditions the posterior on the fixed variables
:param posterior: full posterior distribution
:type posterior: :class:`binf.pdf.posteriors.Posterior`
:param settings: simulation settings as specified in a
config file
... |
Conditions the posterior on the fixed variables
:param posterior: full posterior distribution
:type posterior: :class:`binf.pdf.posteriors.Posterior`
:param settings: simulation settings as specified in a
config file
:type settings: dict of dicts
:returns: a copy of the ... | Conditions the posterior on the fixed variables | [
"Conditions",
"the",
"posterior",
"on",
"the",
"fixed",
"variables"
] | def make_conditional_posterior(posterior, settings):
variables = settings['general']['variables'].split(',')
variables = [x.strip() for x in variables]
p = posterior
if not 'norm' in variables:
return p.conditional_factory(norm=settings['initial_state']['norm'])
else:
return p | [
"def",
"make_conditional_posterior",
"(",
"posterior",
",",
"settings",
")",
":",
"variables",
"=",
"settings",
"[",
"'general'",
"]",
"[",
"'variables'",
"]",
".",
"split",
"(",
"','",
")",
"variables",
"=",
"[",
"x",
".",
"strip",
"(",
")",
"for",
"x",... | Conditions the posterior on the fixed variables | [
"Conditions",
"the",
"posterior",
"on",
"the",
"fixed",
"variables"
] | [
"\"\"\"\n Conditions the posterior on the fixed variables\n\n :param posterior: full posterior distribution\n :type posterior: :class:`binf.pdf.posteriors.Posterior`\n\n :param settings: simulation settings as specified in a\n config file\n :type settings: dict of dicts\n\n :re... | [
{
"param": "posterior",
"type": null
},
{
"param": "settings",
"type": null
}
] | {
"returns": [
{
"docstring": "a copy of the input posterior distribution, but with\nsome variables set to values specified in settings",
"docstring_tokens": [
"a",
"copy",
"of",
"the",
"input",
"posterior",
"distribution",
"but",
... |
6851afd593e7fd26e8097ce8f62d3135acfdb5c0 | simeoncarstens/ensemble_hic | ensemble_hic/setup_functions.py | [
"Unlicense",
"MIT"
] | Python | make_backbone_prior | <not_specific> | def make_backbone_prior(bead_radii, backbone_prior_params, n_beads,
n_structures):
"""
Makes the default backbone prior object.
:param bead_radii: list of bead radii
:type bead_radii: :class:`numpy.ndarray`
:param backbone_prior_params: settings for the backbone prior as
... |
Makes the default backbone prior object.
:param bead_radii: list of bead radii
:type bead_radii: :class:`numpy.ndarray`
:param backbone_prior_params: settings for the backbone prior as
specified in a config file
:type backbone_prior_params: dict
:param n_bea... | Makes the default backbone prior object. | [
"Makes",
"the",
"default",
"backbone",
"prior",
"object",
"."
] | def make_backbone_prior(bead_radii, backbone_prior_params, n_beads,
n_structures):
from .backbone_prior import BackbonePrior
if 'mol_ranges' in backbone_prior_params:
mol_ranges = backbone_prior_params['mol_ranges']
else:
mol_ranges = None
if mol_ranges is None:
... | [
"def",
"make_backbone_prior",
"(",
"bead_radii",
",",
"backbone_prior_params",
",",
"n_beads",
",",
"n_structures",
")",
":",
"from",
".",
"backbone_prior",
"import",
"BackbonePrior",
"if",
"'mol_ranges'",
"in",
"backbone_prior_params",
":",
"mol_ranges",
"=",
"backbo... | Makes the default backbone prior object. | [
"Makes",
"the",
"default",
"backbone",
"prior",
"object",
"."
] | [
"\"\"\"\n Makes the default backbone prior object.\n\n :param bead_radii: list of bead radii\n :type bead_radii: :class:`numpy.ndarray`\n\n :param backbone_prior_params: settings for the backbone prior as\n specified in a config file\n :type backbone_prior_params: dic... | [
{
"param": "bead_radii",
"type": null
},
{
"param": "backbone_prior_params",
"type": null
},
{
"param": "n_beads",
"type": null
},
{
"param": "n_structures",
"type": null
}
] | {
"returns": [
{
"docstring": "the backbone prior object with parameters set as given\nin the settings",
"docstring_tokens": [
"the",
"backbone",
"prior",
"object",
"with",
"parameters",
"set",
"as",
"given",
"in",
... |
6851afd593e7fd26e8097ce8f62d3135acfdb5c0 | simeoncarstens/ensemble_hic | ensemble_hic/setup_functions.py | [
"Unlicense",
"MIT"
] | Python | make_priors | <not_specific> | def make_priors(nonbonded_prior_params, backbone_prior_params,
sphere_prior_params, n_beads, n_structures):
"""
Sets up all structural prior distributions
:param nonbonded_prior_params: settings for the non-bonded prior
as specified in a config file
:t... |
Sets up all structural prior distributions
:param nonbonded_prior_params: settings for the non-bonded prior
as specified in a config file
:type nonbonded_prior_params: dict
:param backbone_prior_params: settings for the backbone prior
... | Sets up all structural prior distributions | [
"Sets",
"up",
"all",
"structural",
"prior",
"distributions"
] | def make_priors(nonbonded_prior_params, backbone_prior_params,
sphere_prior_params, n_beads, n_structures):
nb_params = nonbonded_prior_params
try:
bead_radius = float(nb_params['bead_radii'])
bead_radii = np.ones(n_beads) * bead_radius
except:
bead_radii = np.loadtxt... | [
"def",
"make_priors",
"(",
"nonbonded_prior_params",
",",
"backbone_prior_params",
",",
"sphere_prior_params",
",",
"n_beads",
",",
"n_structures",
")",
":",
"nb_params",
"=",
"nonbonded_prior_params",
"try",
":",
"bead_radius",
"=",
"float",
"(",
"nb_params",
"[",
... | Sets up all structural prior distributions | [
"Sets",
"up",
"all",
"structural",
"prior",
"distributions"
] | [
"\"\"\"\n Sets up all structural prior distributions\n\n :param nonbonded_prior_params: settings for the non-bonded prior\n as specified in a config file\n :type nonbonded_prior_params: dict\n\n :param backbone_prior_params: settings for the backbone prior\n ... | [
{
"param": "nonbonded_prior_params",
"type": null
},
{
"param": "backbone_prior_params",
"type": null
},
{
"param": "sphere_prior_params",
"type": null
},
{
"param": "n_beads",
"type": null
},
{
"param": "n_structures",
"type": null
}
] | {
"returns": [
{
"docstring": "a dictionary with keys being the names of the\nstructural prior distributions and values\nthe prior objects themselves",
"docstring_tokens": [
"a",
"dictionary",
"with",
"keys",
"being",
"the",
"names",
"of"... |
6851afd593e7fd26e8097ce8f62d3135acfdb5c0 | simeoncarstens/ensemble_hic | ensemble_hic/setup_functions.py | [
"Unlicense",
"MIT"
] | Python | make_nonbonded_prior | <not_specific> | def make_nonbonded_prior(nb_params, bead_radii, n_structures):
"""
Makes the default non-bonded structural prior object.
This will either be a Boltzmann-like distribution or a
Tsallis ensemble (currently not really supported).
:param nonbonded_prior_params: settings for the non-bonded prior as
... |
Makes the default non-bonded structural prior object.
This will either be a Boltzmann-like distribution or a
Tsallis ensemble (currently not really supported).
:param nonbonded_prior_params: settings for the non-bonded prior as
specified in a config file
:type n... | Makes the default non-bonded structural prior object.
This will either be a Boltzmann-like distribution or a
Tsallis ensemble (currently not really supported). | [
"Makes",
"the",
"default",
"non",
"-",
"bonded",
"structural",
"prior",
"object",
".",
"This",
"will",
"either",
"be",
"a",
"Boltzmann",
"-",
"like",
"distribution",
"or",
"a",
"Tsallis",
"ensemble",
"(",
"currently",
"not",
"really",
"supported",
")",
"."
] | def make_nonbonded_prior(nb_params, bead_radii, n_structures):
from .forcefields import NBLForceField as ForceField
forcefield = ForceField(bead_radii, float(nb_params['force_constant']))
if not 'ensemble' in nb_params or nb_params['ensemble'] == 'boltzmann':
from .nonbonded_prior import BoltzmannNo... | [
"def",
"make_nonbonded_prior",
"(",
"nb_params",
",",
"bead_radii",
",",
"n_structures",
")",
":",
"from",
".",
"forcefields",
"import",
"NBLForceField",
"as",
"ForceField",
"forcefield",
"=",
"ForceField",
"(",
"bead_radii",
",",
"float",
"(",
"nb_params",
"[",
... | Makes the default non-bonded structural prior object. | [
"Makes",
"the",
"default",
"non",
"-",
"bonded",
"structural",
"prior",
"object",
"."
] | [
"\"\"\"\n Makes the default non-bonded structural prior object.\n\n This will either be a Boltzmann-like distribution or a\n Tsallis ensemble (currently not really supported).\n\n :param nonbonded_prior_params: settings for the non-bonded prior as\n specified in a confi... | [
{
"param": "nb_params",
"type": null
},
{
"param": "bead_radii",
"type": null
},
{
"param": "n_structures",
"type": null
}
] | {
"returns": [
{
"docstring": "the non-bonded prior object with parameters set as given\nin the settings",
"docstring_tokens": [
"the",
"non",
"-",
"bonded",
"prior",
"object",
"with",
"parameters",
"set",
"as",
"g... |
6851afd593e7fd26e8097ce8f62d3135acfdb5c0 | simeoncarstens/ensemble_hic | ensemble_hic/setup_functions.py | [
"Unlicense",
"MIT"
] | Python | make_sphere_prior | <not_specific> | def make_sphere_prior(sphere_prior_params, bead_radii, n_structures):
"""
Makes a sphere structural prior object.
This is a Boltzmann-like distribution with a potential energy
harmonically restraining all beads to stay within a sphere
of a given radius.
:param sphere_prior_params: settings for... |
Makes a sphere structural prior object.
This is a Boltzmann-like distribution with a potential energy
harmonically restraining all beads to stay within a sphere
of a given radius.
:param sphere_prior_params: settings for the sphere prior as
specified in a config fi... | Makes a sphere structural prior object.
This is a Boltzmann-like distribution with a potential energy
harmonically restraining all beads to stay within a sphere
of a given radius. | [
"Makes",
"a",
"sphere",
"structural",
"prior",
"object",
".",
"This",
"is",
"a",
"Boltzmann",
"-",
"like",
"distribution",
"with",
"a",
"potential",
"energy",
"harmonically",
"restraining",
"all",
"beads",
"to",
"stay",
"within",
"a",
"sphere",
"of",
"a",
"g... | def make_sphere_prior(sphere_prior_params, bead_radii, n_structures):
from .sphere_prior import SpherePrior
radius = sphere_prior_params['radius']
if radius == 'auto':
radius = 2 * bead_radii.mean() * len(bead_radii) ** (1 / 3.0)
else:
radius = float(radius)
SP = SpherePrior('sphere_... | [
"def",
"make_sphere_prior",
"(",
"sphere_prior_params",
",",
"bead_radii",
",",
"n_structures",
")",
":",
"from",
".",
"sphere_prior",
"import",
"SpherePrior",
"radius",
"=",
"sphere_prior_params",
"[",
"'radius'",
"]",
"if",
"radius",
"==",
"'auto'",
":",
"radius... | Makes a sphere structural prior object. | [
"Makes",
"a",
"sphere",
"structural",
"prior",
"object",
"."
] | [
"\"\"\"\n Makes a sphere structural prior object.\n\n This is a Boltzmann-like distribution with a potential energy\n harmonically restraining all beads to stay within a sphere\n of a given radius.\n\n :param sphere_prior_params: settings for the sphere prior as\n speci... | [
{
"param": "sphere_prior_params",
"type": null
},
{
"param": "bead_radii",
"type": null
},
{
"param": "n_structures",
"type": null
}
] | {
"returns": [
{
"docstring": "the sphere prior object with parameters set as given\nin the settings",
"docstring_tokens": [
"the",
"sphere",
"prior",
"object",
"with",
"parameters",
"set",
"as",
"given",
"in",
"th... |
6851afd593e7fd26e8097ce8f62d3135acfdb5c0 | simeoncarstens/ensemble_hic | ensemble_hic/setup_functions.py | [
"Unlicense",
"MIT"
] | Python | make_likelihood | <not_specific> | def make_likelihood(forward_model_params, error_model, data_filtering_params,
data_file, n_structures, bead_radii):
"""
Sets up a likelihood object from settings parsed from a config
file
:param forward_model_params: settings for the forward model as
... |
Sets up a likelihood object from settings parsed from a config
file
:param forward_model_params: settings for the forward model as
specified in a config file
:type forward_model_params: dict
:param error_model: a string telling which error model to use.
... | Sets up a likelihood object from settings parsed from a config
file | [
"Sets",
"up",
"a",
"likelihood",
"object",
"from",
"settings",
"parsed",
"from",
"a",
"config",
"file"
] | def make_likelihood(forward_model_params, error_model, data_filtering_params,
data_file, n_structures, bead_radii):
from .forward_models import EnsembleContactsFWM
from .likelihoods import Likelihood
data = parse_data(data_file, data_filtering_params)
cd_factor = float(forward_model_... | [
"def",
"make_likelihood",
"(",
"forward_model_params",
",",
"error_model",
",",
"data_filtering_params",
",",
"data_file",
",",
"n_structures",
",",
"bead_radii",
")",
":",
"from",
".",
"forward_models",
"import",
"EnsembleContactsFWM",
"from",
".",
"likelihoods",
"im... | Sets up a likelihood object from settings parsed from a config
file | [
"Sets",
"up",
"a",
"likelihood",
"object",
"from",
"settings",
"parsed",
"from",
"a",
"config",
"file"
] | [
"\"\"\"\n Sets up a likelihood object from settings parsed from a config\n file\n\n :param forward_model_params: settings for the forward model as\n specified in a config file\n :type forward_model_params: dict\n\n :param error_model: a string telling which error model... | [
{
"param": "forward_model_params",
"type": null
},
{
"param": "error_model",
"type": null
},
{
"param": "data_filtering_params",
"type": null
},
{
"param": "data_file",
"type": null
},
{
"param": "n_structures",
"type": null
},
{
"param": "bead_radii",... | {
"returns": [
{
"docstring": "the ready-to-use likelihood object",
"docstring_tokens": [
"the",
"ready",
"-",
"to",
"-",
"use",
"likelihood",
"object"
],
"type": ":class:`.Likelihood`"
}
],
"raises": [],
"params": [... |
5ced9d1d1f81ee69e52e19f8d852eb97c2cf36db | simeoncarstens/ensemble_hic | ensemble_hic/forward_models.py | [
"Unlicense",
"MIT"
] | Python | _evaluate | <not_specific> | def _evaluate(self, structures, smooth_steepness, norm):
"""
Evaluates the forward model, i.e., back-calculates contact
data from a structure ensemble and other (nuisance) parameters
:param structures: coordinates of structure ensemble
:type structures: :class:`numpy.ndarray`
... |
Evaluates the forward model, i.e., back-calculates contact
data from a structure ensemble and other (nuisance) parameters
:param structures: coordinates of structure ensemble
:type structures: :class:`numpy.ndarray`
:param smooth_steepness: determines the steepness of the smoo... | Evaluates the forward model, i.e., back-calculates contact
data from a structure ensemble and other (nuisance) parameters | [
"Evaluates",
"the",
"forward",
"model",
"i",
".",
"e",
".",
"back",
"-",
"calculates",
"contact",
"data",
"from",
"a",
"structure",
"ensemble",
"and",
"other",
"(",
"nuisance",
")",
"parameters"
] | def _evaluate(self, structures, smooth_steepness, norm):
X = structures.reshape(self.n_structures, -1, 3)
return ensemble_contacts_evaluate(X,
norm,
self['contact_distances'].value,
... | [
"def",
"_evaluate",
"(",
"self",
",",
"structures",
",",
"smooth_steepness",
",",
"norm",
")",
":",
"X",
"=",
"structures",
".",
"reshape",
"(",
"self",
".",
"n_structures",
",",
"-",
"1",
",",
"3",
")",
"return",
"ensemble_contacts_evaluate",
"(",
"X",
... | Evaluates the forward model, i.e., back-calculates contact
data from a structure ensemble and other (nuisance) parameters | [
"Evaluates",
"the",
"forward",
"model",
"i",
".",
"e",
".",
"back",
"-",
"calculates",
"contact",
"data",
"from",
"a",
"structure",
"ensemble",
"and",
"other",
"(",
"nuisance",
")",
"parameters"
] | [
"\"\"\"\n Evaluates the forward model, i.e., back-calculates contact\n data from a structure ensemble and other (nuisance) parameters\n\n :param structures: coordinates of structure ensemble\n :type structures: :class:`numpy.ndarray`\n\n :param smooth_steepness: determines the ste... | [
{
"param": "self",
"type": null
},
{
"param": "structures",
"type": null
},
{
"param": "smooth_steepness",
"type": null
},
{
"param": "norm",
"type": null
}
] | {
"returns": [
{
"docstring": "back-calculated contact frequency data",
"docstring_tokens": [
"back",
"-",
"calculated",
"contact",
"frequency",
"data"
],
"type": ":class:`numpy.ndarray`"
}
],
"raises": [],
"params": [
{
"... |
5ced9d1d1f81ee69e52e19f8d852eb97c2cf36db | simeoncarstens/ensemble_hic | ensemble_hic/forward_models.py | [
"Unlicense",
"MIT"
] | Python | _evaluate_jacobi_matrix | null | def _evaluate_jacobi_matrix(self, structures, smooth_steepness, norm):
"""
In theory, this evaluates the Jacobian matrix of the forward model,
but I usually hardcode the multiplication of this with the error
model gradient in Cython (see :module:`.likelihoods_c`)
"""
... |
In theory, this evaluates the Jacobian matrix of the forward model,
but I usually hardcode the multiplication of this with the error
model gradient in Cython (see :module:`.likelihoods_c`)
| In theory, this evaluates the Jacobian matrix of the forward model,
but I usually hardcode the multiplication of this with the error
model gradient in Cython | [
"In",
"theory",
"this",
"evaluates",
"the",
"Jacobian",
"matrix",
"of",
"the",
"forward",
"model",
"but",
"I",
"usually",
"hardcode",
"the",
"multiplication",
"of",
"this",
"with",
"the",
"error",
"model",
"gradient",
"in",
"Cython"
] | def _evaluate_jacobi_matrix(self, structures, smooth_steepness, norm):
raise NotImplementedError("Use fast likelihood gradients in " +
"likelihoods_c.pyx instead!") | [
"def",
"_evaluate_jacobi_matrix",
"(",
"self",
",",
"structures",
",",
"smooth_steepness",
",",
"norm",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"Use fast likelihood gradients in \"",
"+",
"\"likelihoods_c.pyx instead!\"",
")"
] | In theory, this evaluates the Jacobian matrix of the forward model,
but I usually hardcode the multiplication of this with the error
model gradient in Cython (see :module:`.likelihoods_c`) | [
"In",
"theory",
"this",
"evaluates",
"the",
"Jacobian",
"matrix",
"of",
"the",
"forward",
"model",
"but",
"I",
"usually",
"hardcode",
"the",
"multiplication",
"of",
"this",
"with",
"the",
"error",
"model",
"gradient",
"in",
"Cython",
"(",
"see",
":",
"module... | [
"\"\"\"\n In theory, this evaluates the Jacobian matrix of the forward model,\n but I usually hardcode the multiplication of this with the error\n model gradient in Cython (see :module:`.likelihoods_c`)\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "structures",
"type": null
},
{
"param": "smooth_steepness",
"type": null
},
{
"param": "norm",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "structures",
"type": null,
"docstring": null,
"docstring_toke... |
47c0bd129deab907a4dc865040fa74b921a1929b | simeoncarstens/ensemble_hic | ensemble_hic/nonbonded_prior.py | [
"Unlicense",
"MIT"
] | Python | _register_ensemble_parameters | null | def _register_ensemble_parameters(self, **parameters):
"""
Register parameters of the statistical ensemble, for example
the inverse temperature in case of a Boltzmann ensemble
"""
pass |
Register parameters of the statistical ensemble, for example
the inverse temperature in case of a Boltzmann ensemble
| Register parameters of the statistical ensemble, for example
the inverse temperature in case of a Boltzmann ensemble | [
"Register",
"parameters",
"of",
"the",
"statistical",
"ensemble",
"for",
"example",
"the",
"inverse",
"temperature",
"in",
"case",
"of",
"a",
"Boltzmann",
"ensemble"
] | def _register_ensemble_parameters(self, **parameters):
pass | [
"def",
"_register_ensemble_parameters",
"(",
"self",
",",
"**",
"parameters",
")",
":",
"pass"
] | Register parameters of the statistical ensemble, for example
the inverse temperature in case of a Boltzmann ensemble | [
"Register",
"parameters",
"of",
"the",
"statistical",
"ensemble",
"for",
"example",
"the",
"inverse",
"temperature",
"in",
"case",
"of",
"a",
"Boltzmann",
"ensemble"
] | [
"\"\"\"\n Register parameters of the statistical ensemble, for example\n the inverse temperature in case of a Boltzmann ensemble\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
47c0bd129deab907a4dc865040fa74b921a1929b | simeoncarstens/ensemble_hic | ensemble_hic/nonbonded_prior.py | [
"Unlicense",
"MIT"
] | Python | _forcefield_gradient | <not_specific> | def _forcefield_gradient(self, structure):
"""
Evaluates the gradient of the force field
:param structure: coordinates of structure ensemble
:type structure: :class:`numpy.ndarray`
:returns: gradient vector
:rtype: :class:`numpy.ndarray`
"""
return self... |
Evaluates the gradient of the force field
:param structure: coordinates of structure ensemble
:type structure: :class:`numpy.ndarray`
:returns: gradient vector
:rtype: :class:`numpy.ndarray`
| Evaluates the gradient of the force field | [
"Evaluates",
"the",
"gradient",
"of",
"the",
"force",
"field"
] | def _forcefield_gradient(self, structure):
return self.forcefield.gradient(structure) | [
"def",
"_forcefield_gradient",
"(",
"self",
",",
"structure",
")",
":",
"return",
"self",
".",
"forcefield",
".",
"gradient",
"(",
"structure",
")"
] | Evaluates the gradient of the force field | [
"Evaluates",
"the",
"gradient",
"of",
"the",
"force",
"field"
] | [
"\"\"\"\n Evaluates the gradient of the force field\n\n :param structure: coordinates of structure ensemble\n :type structure: :class:`numpy.ndarray`\n\n :returns: gradient vector\n :rtype: :class:`numpy.ndarray`\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "structure",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": ":class:`numpy.ndarray`"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"i... |
47c0bd129deab907a4dc865040fa74b921a1929b | simeoncarstens/ensemble_hic | ensemble_hic/nonbonded_prior.py | [
"Unlicense",
"MIT"
] | Python | _forcefield_energy | <not_specific> | def _forcefield_energy(self, structure):
"""
Evaluates the energy of the force field
:param structure: coordinates of structure ensemble
:type structure: :class:`numpy.ndarray`
:returns: force field energy
:rtype: float
"""
return self.forcefield.energy... |
Evaluates the energy of the force field
:param structure: coordinates of structure ensemble
:type structure: :class:`numpy.ndarray`
:returns: force field energy
:rtype: float
| Evaluates the energy of the force field | [
"Evaluates",
"the",
"energy",
"of",
"the",
"force",
"field"
] | def _forcefield_energy(self, structure):
return self.forcefield.energy(structure) | [
"def",
"_forcefield_energy",
"(",
"self",
",",
"structure",
")",
":",
"return",
"self",
".",
"forcefield",
".",
"energy",
"(",
"structure",
")"
] | Evaluates the energy of the force field | [
"Evaluates",
"the",
"energy",
"of",
"the",
"force",
"field"
] | [
"\"\"\"\n Evaluates the energy of the force field\n\n :param structure: coordinates of structure ensemble\n :type structure: :class:`numpy.ndarray`\n\n :returns: force field energy\n :rtype: float\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "structure",
"type": null
}
] | {
"returns": [
{
"docstring": "force field energy",
"docstring_tokens": [
"force",
"field",
"energy"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": ... |
47c0bd129deab907a4dc865040fa74b921a1929b | simeoncarstens/ensemble_hic | ensemble_hic/nonbonded_prior.py | [
"Unlicense",
"MIT"
] | Python | _log_ensemble_gradient | null | def _log_ensemble_gradient(self, E):
"""
Derivative of the statistical ensemble w.r.t. the system energy.
Should be called log_ensemble_derivative or sth. like that.
:param E: system energy calculated by a force field object
:type E: float
:returns: derivative w.r.t. t... |
Derivative of the statistical ensemble w.r.t. the system energy.
Should be called log_ensemble_derivative or sth. like that.
:param E: system energy calculated by a force field object
:type E: float
:returns: derivative w.r.t. the energy
:rtype: float
| Derivative of the statistical ensemble w.r.t. the system energy.
Should be called log_ensemble_derivative or sth. like that. | [
"Derivative",
"of",
"the",
"statistical",
"ensemble",
"w",
".",
"r",
".",
"t",
".",
"the",
"system",
"energy",
".",
"Should",
"be",
"called",
"log_ensemble_derivative",
"or",
"sth",
".",
"like",
"that",
"."
] | def _log_ensemble_gradient(self, E):
pass | [
"def",
"_log_ensemble_gradient",
"(",
"self",
",",
"E",
")",
":",
"pass"
] | Derivative of the statistical ensemble w.r.t. | [
"Derivative",
"of",
"the",
"statistical",
"ensemble",
"w",
".",
"r",
".",
"t",
"."
] | [
"\"\"\"\n Derivative of the statistical ensemble w.r.t. the system energy.\n\n Should be called log_ensemble_derivative or sth. like that.\n\n :param E: system energy calculated by a force field object\n :type E: float\n\n :returns: derivative w.r.t. the energy\n :rtype: fl... | [
{
"param": "self",
"type": null
},
{
"param": "E",
"type": null
}
] | {
"returns": [
{
"docstring": "derivative w.r.t. the energy",
"docstring_tokens": [
"derivative",
"w",
".",
"r",
".",
"t",
".",
"the",
"energy"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"i... |
47c0bd129deab907a4dc865040fa74b921a1929b | simeoncarstens/ensemble_hic | ensemble_hic/nonbonded_prior.py | [
"Unlicense",
"MIT"
] | Python | _log_ensemble | null | def _log_ensemble(self, E):
"""
The logarithm of the statistical ensemble, for example,
-beta * E in case of a Boltzmann ensemble
:param E: system energy calculated by a force field object
:type E: float
"""
pass |
The logarithm of the statistical ensemble, for example,
-beta * E in case of a Boltzmann ensemble
:param E: system energy calculated by a force field object
:type E: float
| The logarithm of the statistical ensemble, for example,
beta * E in case of a Boltzmann ensemble | [
"The",
"logarithm",
"of",
"the",
"statistical",
"ensemble",
"for",
"example",
"beta",
"*",
"E",
"in",
"case",
"of",
"a",
"Boltzmann",
"ensemble"
] | def _log_ensemble(self, E):
pass | [
"def",
"_log_ensemble",
"(",
"self",
",",
"E",
")",
":",
"pass"
] | The logarithm of the statistical ensemble, for example,
beta * E in case of a Boltzmann ensemble | [
"The",
"logarithm",
"of",
"the",
"statistical",
"ensemble",
"for",
"example",
"beta",
"*",
"E",
"in",
"case",
"of",
"a",
"Boltzmann",
"ensemble"
] | [
"\"\"\"\n The logarithm of the statistical ensemble, for example,\n -beta * E in case of a Boltzmann ensemble\n\n :param E: system energy calculated by a force field object\n :type E: float\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "E",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "E",
"type": null,
"docstring": "system energy calculated by a force... |
09d646a41ffc0c9373d66e9994c2e1dd73c61375 | simeoncarstens/ensemble_hic | ensemble_hic/error_models.py | [
"Unlicense",
"MIT"
] | Python | _evaluate_log_prob | <not_specific> | def _evaluate_log_prob(self, mock_data):
"""
Evaluates the log-probability of the data given the mock data
:param mock_data: back-calculated count / frequency data
:type mock_data: :class:`numpy.ndarray`
:returns: log-probablity of the data
:rtype: float
... |
Evaluates the log-probability of the data given the mock data
:param mock_data: back-calculated count / frequency data
:type mock_data: :class:`numpy.ndarray`
:returns: log-probablity of the data
:rtype: float
| Evaluates the log-probability of the data given the mock data | [
"Evaluates",
"the",
"log",
"-",
"probability",
"of",
"the",
"data",
"given",
"the",
"mock",
"data"
] | def _evaluate_log_prob(self, mock_data):
d_counts = self.data
return -mock_data.sum() + numpy.sum(d_counts * numpy.log(mock_data)) | [
"def",
"_evaluate_log_prob",
"(",
"self",
",",
"mock_data",
")",
":",
"d_counts",
"=",
"self",
".",
"data",
"return",
"-",
"mock_data",
".",
"sum",
"(",
")",
"+",
"numpy",
".",
"sum",
"(",
"d_counts",
"*",
"numpy",
".",
"log",
"(",
"mock_data",
")",
... | Evaluates the log-probability of the data given the mock data | [
"Evaluates",
"the",
"log",
"-",
"probability",
"of",
"the",
"data",
"given",
"the",
"mock",
"data"
] | [
"\"\"\"\n Evaluates the log-probability of the data given the mock data\n \n :param mock_data: back-calculated count / frequency data\n :type mock_data: :class:`numpy.ndarray`\n\n :returns: log-probablity of the data\n :rtype: float\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "mock_data",
"type": null
}
] | {
"returns": [
{
"docstring": "log-probablity of the data",
"docstring_tokens": [
"log",
"-",
"probablity",
"of",
"the",
"data"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
... |
09d646a41ffc0c9373d66e9994c2e1dd73c61375 | simeoncarstens/ensemble_hic | ensemble_hic/error_models.py | [
"Unlicense",
"MIT"
] | Python | _evaluate_gradient | null | def _evaluate_gradient(self, **variables):
"""
In theory, this evaluates the gradient of the negative log-probability,
but I usually hardcode the multiplication of this with the forward
model Jacobian in Cython (see :mod:`.likelihoods_c`)
"""
pass |
In theory, this evaluates the gradient of the negative log-probability,
but I usually hardcode the multiplication of this with the forward
model Jacobian in Cython (see :mod:`.likelihoods_c`)
| In theory, this evaluates the gradient of the negative log-probability,
but I usually hardcode the multiplication of this with the forward
model Jacobian in Cython | [
"In",
"theory",
"this",
"evaluates",
"the",
"gradient",
"of",
"the",
"negative",
"log",
"-",
"probability",
"but",
"I",
"usually",
"hardcode",
"the",
"multiplication",
"of",
"this",
"with",
"the",
"forward",
"model",
"Jacobian",
"in",
"Cython"
] | def _evaluate_gradient(self, **variables):
pass | [
"def",
"_evaluate_gradient",
"(",
"self",
",",
"**",
"variables",
")",
":",
"pass"
] | In theory, this evaluates the gradient of the negative log-probability,
but I usually hardcode the multiplication of this with the forward
model Jacobian in Cython (see :mod:`.likelihoods_c`) | [
"In",
"theory",
"this",
"evaluates",
"the",
"gradient",
"of",
"the",
"negative",
"log",
"-",
"probability",
"but",
"I",
"usually",
"hardcode",
"the",
"multiplication",
"of",
"this",
"with",
"the",
"forward",
"model",
"Jacobian",
"in",
"Cython",
"(",
"see",
"... | [
"\"\"\"\n In theory, this evaluates the gradient of the negative log-probability,\n but I usually hardcode the multiplication of this with the forward\n model Jacobian in Cython (see :mod:`.likelihoods_c`)\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
09d646a41ffc0c9373d66e9994c2e1dd73c61375 | simeoncarstens/ensemble_hic | ensemble_hic/error_models.py | [
"Unlicense",
"MIT"
] | Python | clone | <not_specific> | def clone(self):
"""Returns a copy of an instance of this class
:returns: copy of this object
:rtype: :class:`.PoissonEM`
"""
copy = self.__class__(self.name, self.data)
copy.set_fixed_variables_from_pdf(self)
return copy | Returns a copy of an instance of this class
:returns: copy of this object
:rtype: :class:`.PoissonEM`
| Returns a copy of an instance of this class | [
"Returns",
"a",
"copy",
"of",
"an",
"instance",
"of",
"this",
"class"
] | def clone(self):
copy = self.__class__(self.name, self.data)
copy.set_fixed_variables_from_pdf(self)
return copy | [
"def",
"clone",
"(",
"self",
")",
":",
"copy",
"=",
"self",
".",
"__class__",
"(",
"self",
".",
"name",
",",
"self",
".",
"data",
")",
"copy",
".",
"set_fixed_variables_from_pdf",
"(",
"self",
")",
"return",
"copy"
] | Returns a copy of an instance of this class | [
"Returns",
"a",
"copy",
"of",
"an",
"instance",
"of",
"this",
"class"
] | [
"\"\"\"Returns a copy of an instance of this class\n\n :returns: copy of this object\n :rtype: :class:`.PoissonEM`\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "copy of this object",
"docstring_tokens": [
"copy",
"of",
"this",
"object"
],
"type": ":class:`.PoissonEM`"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,... |
26f7d04e91d9cdbcfb50d1c58492611364984734 | GFZ-Centre-for-Early-Warning/modelprop | modelprop.py | [
"Apache-2.0"
] | Python | _check_taxonomies | <not_specific> | def _check_taxonomies(self,selected):
'''
check if the taxonomies in the list "selected" are
contained in the metadata
'''
if (self.metadata):
return(set(selected) <= set(self.metadata['taxonomies']))
else:
print("_check_taxonomies: metadata are n... |
check if the taxonomies in the list "selected" are
contained in the metadata
| check if the taxonomies in the list "selected" are
contained in the metadata | [
"check",
"if",
"the",
"taxonomies",
"in",
"the",
"list",
"\"",
"selected",
"\"",
"are",
"contained",
"in",
"the",
"metadata"
] | def _check_taxonomies(self,selected):
if (self.metadata):
return(set(selected) <= set(self.metadata['taxonomies']))
else:
print("_check_taxonomies: metadata are not defined.")
return(False) | [
"def",
"_check_taxonomies",
"(",
"self",
",",
"selected",
")",
":",
"if",
"(",
"self",
".",
"metadata",
")",
":",
"return",
"(",
"set",
"(",
"selected",
")",
"<=",
"set",
"(",
"self",
".",
"metadata",
"[",
"'taxonomies'",
"]",
")",
")",
"else",
":",
... | check if the taxonomies in the list "selected" are
contained in the metadata | [
"check",
"if",
"the",
"taxonomies",
"in",
"the",
"list",
"\"",
"selected",
"\"",
"are",
"contained",
"in",
"the",
"metadata"
] | [
"'''\n check if the taxonomies in the list \"selected\" are \n contained in the metadata\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "selected",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "selected",
"type": null,
"docstring": null,
"docstring_tokens... |
26f7d04e91d9cdbcfb50d1c58492611364984734 | GFZ-Centre-for-Early-Warning/modelprop | modelprop.py | [
"Apache-2.0"
] | Python | _read_schema | <not_specific> | def _read_schema(self, input_file):
'''
read fragility/vulnerability model from a json file.
the file contains two dictionaries:
1) 'meta' includes information (metadata) on the schema, the list of taxonomies and
damage states
2) 'data' provides the mean and log. std ... |
read fragility/vulnerability model from a json file.
the file contains two dictionaries:
1) 'meta' includes information (metadata) on the schema, the list of taxonomies and
damage states
2) 'data' provides the mean and log. std deviation of the lognormal
distribut... | read fragility/vulnerability model from a json file.
the file contains two dictionaries:
1) 'meta' includes information (metadata) on the schema, the list of taxonomies and
damage states
2) 'data' provides the mean and log. std deviation of the lognormal
distribution encoding the fragility / vulnerability descriptions
... | [
"read",
"fragility",
"/",
"vulnerability",
"model",
"from",
"a",
"json",
"file",
".",
"the",
"file",
"contains",
"two",
"dictionaries",
":",
"1",
")",
"'",
"meta",
"'",
"includes",
"information",
"(",
"metadata",
")",
"on",
"the",
"schema",
"the",
"list",
... | def _read_schema(self, input_file):
with open(input_file,'r') as f:
parsed = json.load(f)
self.metadata = parsed['meta']
self.data = pd.DataFrame(parsed['data'])
return(0) | [
"def",
"_read_schema",
"(",
"self",
",",
"input_file",
")",
":",
"with",
"open",
"(",
"input_file",
",",
"'r'",
")",
"as",
"f",
":",
"parsed",
"=",
"json",
".",
"load",
"(",
"f",
")",
"self",
".",
"metadata",
"=",
"parsed",
"[",
"'meta'",
"]",
"sel... | read fragility/vulnerability model from a json file. | [
"read",
"fragility",
"/",
"vulnerability",
"model",
"from",
"a",
"json",
"file",
"."
] | [
"'''\n read fragility/vulnerability model from a json file.\n the file contains two dictionaries: \n 1) 'meta' includes information (metadata) on the schema, the list of taxonomies and\n damage states\n 2) 'data' provides the mean and log. std deviation of the lognormal\n ... | [
{
"param": "self",
"type": null
},
{
"param": "input_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_file",
"type": null,
"docstring": null,
"docstring_toke... |
26f7d04e91d9cdbcfb50d1c58492611364984734 | GFZ-Centre-for-Early-Warning/modelprop | modelprop.py | [
"Apache-2.0"
] | Python | _write_schema | <not_specific> | def _write_schema(self, metadata, data, output_file):
'''
write fragility/vulnerability schema to a json file.
the file contains two dictionaries:
1) 'meta' includes information (metadata) on the schema, the list of taxonomies and
damage states
2) 'data' provides the ... |
write fragility/vulnerability schema to a json file.
the file contains two dictionaries:
1) 'meta' includes information (metadata) on the schema, the list of taxonomies and
damage states
2) 'data' provides the mean and log. std deviation of the lognormal
distribut... | write fragility/vulnerability schema to a json file.
the file contains two dictionaries:
1) 'meta' includes information (metadata) on the schema, the list of taxonomies and
damage states
2) 'data' provides the mean and log. std deviation of the lognormal
distribution encoding the fragility / vulnerability descriptions
... | [
"write",
"fragility",
"/",
"vulnerability",
"schema",
"to",
"a",
"json",
"file",
".",
"the",
"file",
"contains",
"two",
"dictionaries",
":",
"1",
")",
"'",
"meta",
"'",
"includes",
"information",
"(",
"metadata",
")",
"on",
"the",
"schema",
"the",
"list",
... | def _write_schema(self, metadata, data, output_file):
if ((metadata is not None) and (data is not None)):
modict = {}
modict['meta'] = metadata
modict['data'] = data.to_dict(orient='records')
with open(output_file,'w') as f:
json.dump(modict,f, ind... | [
"def",
"_write_schema",
"(",
"self",
",",
"metadata",
",",
"data",
",",
"output_file",
")",
":",
"if",
"(",
"(",
"metadata",
"is",
"not",
"None",
")",
"and",
"(",
"data",
"is",
"not",
"None",
")",
")",
":",
"modict",
"=",
"{",
"}",
"modict",
"[",
... | write fragility/vulnerability schema to a json file. | [
"write",
"fragility",
"/",
"vulnerability",
"schema",
"to",
"a",
"json",
"file",
"."
] | [
"'''\n write fragility/vulnerability schema to a json file.\n the file contains two dictionaries: \n 1) 'meta' includes information (metadata) on the schema, the list of taxonomies and\n damage states\n 2) 'data' provides the mean and log. std deviation of the lognormal\n ... | [
{
"param": "self",
"type": null
},
{
"param": "metadata",
"type": null
},
{
"param": "data",
"type": null
},
{
"param": "output_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "metadata",
"type": null,
"docstring": null,
"docstring_tokens... |
26f7d04e91d9cdbcfb50d1c58492611364984734 | GFZ-Centre-for-Early-Warning/modelprop | modelprop.py | [
"Apache-2.0"
] | Python | _queryModel | <not_specific> | def _queryModel(self):
'''
extract a part of the model by doing a query on the
selected taxonomies (selectedtaxonomies)
'''
if (self.selectedtaxonomies):
if (self._check_taxonomies(self.selectedtaxonomies)):
self.query_result_metadata = self.metadata.... |
extract a part of the model by doing a query on the
selected taxonomies (selectedtaxonomies)
| extract a part of the model by doing a query on the
selected taxonomies (selectedtaxonomies) | [
"extract",
"a",
"part",
"of",
"the",
"model",
"by",
"doing",
"a",
"query",
"on",
"the",
"selected",
"taxonomies",
"(",
"selectedtaxonomies",
")"
] | def _queryModel(self):
if (self.selectedtaxonomies):
if (self._check_taxonomies(self.selectedtaxonomies)):
self.query_result_metadata = self.metadata.copy()
self.query_result_metadata['taxonomies']=self.selectedtaxonomies
self.query_result_data = self.... | [
"def",
"_queryModel",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"selectedtaxonomies",
")",
":",
"if",
"(",
"self",
".",
"_check_taxonomies",
"(",
"self",
".",
"selectedtaxonomies",
")",
")",
":",
"self",
".",
"query_result_metadata",
"=",
"self",
".",... | extract a part of the model by doing a query on the
selected taxonomies (selectedtaxonomies) | [
"extract",
"a",
"part",
"of",
"the",
"model",
"by",
"doing",
"a",
"query",
"on",
"the",
"selected",
"taxonomies",
"(",
"selectedtaxonomies",
")"
] | [
"'''\n extract a part of the model by doing a query on the \n selected taxonomies (selectedtaxonomies)\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
26f7d04e91d9cdbcfb50d1c58492611364984734 | GFZ-Centre-for-Early-Warning/modelprop | modelprop.py | [
"Apache-2.0"
] | Python | _exportGeoJson | <not_specific> | def _exportGeoJson(self, dataframe, filename):
'''
Export geopandas dataframe as GeoJson file
'''
# file has to be first deleted
# because driver does not support overwrite !
try:
os.remove(filename)
except OSError:
pass
dataframe... |
Export geopandas dataframe as GeoJson file
| Export geopandas dataframe as GeoJson file | [
"Export",
"geopandas",
"dataframe",
"as",
"GeoJson",
"file"
] | def _exportGeoJson(self, dataframe, filename):
try:
os.remove(filename)
except OSError:
pass
dataframe.to_file(filename, driver='GeoJSON')
return (0) | [
"def",
"_exportGeoJson",
"(",
"self",
",",
"dataframe",
",",
"filename",
")",
":",
"try",
":",
"os",
".",
"remove",
"(",
"filename",
")",
"except",
"OSError",
":",
"pass",
"dataframe",
".",
"to_file",
"(",
"filename",
",",
"driver",
"=",
"'GeoJSON'",
")"... | Export geopandas dataframe as GeoJson file | [
"Export",
"geopandas",
"dataframe",
"as",
"GeoJson",
"file"
] | [
"'''\n Export geopandas dataframe as GeoJson file\n '''",
"# file has to be first deleted",
"# because driver does not support overwrite ! "
] | [
{
"param": "self",
"type": null
},
{
"param": "dataframe",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dataframe",
"type": null,
"docstring": null,
"docstring_token... |
26f7d04e91d9cdbcfb50d1c58492611364984734 | GFZ-Centre-for-Early-Warning/modelprop | modelprop.py | [
"Apache-2.0"
] | Python | _exportNrml05 | <not_specific> | def _exportNrml05(self, dataframe, filename, metadata, dicts,taxonomies):
'''
Export geopandas dataframe as nrml file
'''
xml_string = nrml.write_nrml05_expo(dataframe,metadata,dicts,taxonomies,filename)
return (0) |
Export geopandas dataframe as nrml file
| Export geopandas dataframe as nrml file | [
"Export",
"geopandas",
"dataframe",
"as",
"nrml",
"file"
] | def _exportNrml05(self, dataframe, filename, metadata, dicts,taxonomies):
xml_string = nrml.write_nrml05_expo(dataframe,metadata,dicts,taxonomies,filename)
return (0) | [
"def",
"_exportNrml05",
"(",
"self",
",",
"dataframe",
",",
"filename",
",",
"metadata",
",",
"dicts",
",",
"taxonomies",
")",
":",
"xml_string",
"=",
"nrml",
".",
"write_nrml05_expo",
"(",
"dataframe",
",",
"metadata",
",",
"dicts",
",",
"taxonomies",
",",
... | Export geopandas dataframe as nrml file | [
"Export",
"geopandas",
"dataframe",
"as",
"nrml",
"file"
] | [
"'''\n Export geopandas dataframe as nrml file\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "dataframe",
"type": null
},
{
"param": "filename",
"type": null
},
{
"param": "metadata",
"type": null
},
{
"param": "dicts",
"type": null
},
{
"param": "taxonomies",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dataframe",
"type": null,
"docstring": null,
"docstring_token... |
26f7d04e91d9cdbcfb50d1c58492611364984734 | GFZ-Centre-for-Early-Warning/modelprop | modelprop.py | [
"Apache-2.0"
] | Python | _write_outputs | null | def _write_outputs(self):
'''
Export query result as nrml and geojson files
'''
output_geojson = os.path.join(self.path_outfile,self.out_file_geojson)
self._write_schema(self.query_result_metadata, self.query_result_data,output_geojson)
#output_xml = os.path.join(self.pat... |
Export query result as nrml and geojson files
| Export query result as nrml and geojson files | [
"Export",
"query",
"result",
"as",
"nrml",
"and",
"geojson",
"files"
] | def _write_outputs(self):
output_geojson = os.path.join(self.path_outfile,self.out_file_geojson)
self._write_schema(self.query_result_metadata, self.query_result_data,output_geojson) | [
"def",
"_write_outputs",
"(",
"self",
")",
":",
"output_geojson",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"path_outfile",
",",
"self",
".",
"out_file_geojson",
")",
"self",
".",
"_write_schema",
"(",
"self",
".",
"query_result_metadata",
",",
... | Export query result as nrml and geojson files | [
"Export",
"query",
"result",
"as",
"nrml",
"and",
"geojson",
"files"
] | [
"'''\n Export query result as nrml and geojson files\n '''",
"#output_xml = os.path.join(self.path_outfile,self.out_file_xml)",
"#self._exportNrml05(self.query_result, output_xml, self.metadata, ",
"# self.dicts,self.taxonomies)"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
26f7d04e91d9cdbcfb50d1c58492611364984734 | GFZ-Centre-for-Early-Warning/modelprop | modelprop.py | [
"Apache-2.0"
] | Python | run | <not_specific> | def run(self):
'''
Method to:
- load the fragility model from a file (json)
- query the model based on a list of taxonomies
- write the output(s)
'''
if (self._check_schema()):
foldername = os.path.join(self.folder,"schemas/{}".format(self.schema))
... |
Method to:
- load the fragility model from a file (json)
- query the model based on a list of taxonomies
- write the output(s)
| Method to:
load the fragility model from a file (json)
query the model based on a list of taxonomies
write the output(s) | [
"Method",
"to",
":",
"load",
"the",
"fragility",
"model",
"from",
"a",
"file",
"(",
"json",
")",
"query",
"the",
"model",
"based",
"on",
"a",
"list",
"of",
"taxonomies",
"write",
"the",
"output",
"(",
"s",
")"
] | def run(self):
if (self._check_schema()):
foldername = os.path.join(self.folder,"schemas/{}".format(self.schema))
self.path_infile = foldername
self.in_file = "{}_struct.json".format(self.schema)
else:
raise Exception ("schema {} not supported".format(self... | [
"def",
"run",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_check_schema",
"(",
")",
")",
":",
"foldername",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"folder",
",",
"\"schemas/{}\"",
".",
"format",
"(",
"self",
".",
"schema",
")",
... | Method to:
load the fragility model from a file (json)
query the model based on a list of taxonomies
write the output(s) | [
"Method",
"to",
":",
"load",
"the",
"fragility",
"model",
"from",
"a",
"file",
"(",
"json",
")",
"query",
"the",
"model",
"based",
"on",
"a",
"list",
"of",
"taxonomies",
"write",
"the",
"output",
"(",
"s",
")"
] | [
"'''\n Method to:\n - load the fragility model from a file (json)\n - query the model based on a list of taxonomies\n - write the output(s)\n '''",
"#read model from file ",
"#query",
"#write outputs"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
26f7d04e91d9cdbcfb50d1c58492611364984734 | GFZ-Centre-for-Early-Warning/modelprop | modelprop.py | [
"Apache-2.0"
] | Python | create_with_arg_parser | <not_specific> | def create_with_arg_parser(cls):
'''
Creates an arg parser and uses that to create the Main class
'''
arg_parser = argparse.ArgumentParser(
description='''Program to query a fragility/vulnerability
model from a database/file'''
)
arg_parser.add_arg... |
Creates an arg parser and uses that to create the Main class
| Creates an arg parser and uses that to create the Main class | [
"Creates",
"an",
"arg",
"parser",
"and",
"uses",
"that",
"to",
"create",
"the",
"Main",
"class"
] | def create_with_arg_parser(cls):
arg_parser = argparse.ArgumentParser(
description='''Program to query a fragility/vulnerability
model from a database/file'''
)
arg_parser.add_argument(
'schema',
help='Exposure/Vulnerability Schema',
ty... | [
"def",
"create_with_arg_parser",
"(",
"cls",
")",
":",
"arg_parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'''Program to query a fragility/vulnerability\n model from a database/file'''",
")",
"arg_parser",
".",
"add_argument",
"(",
"'sch... | Creates an arg parser and uses that to create the Main class | [
"Creates",
"an",
"arg",
"parser",
"and",
"uses",
"that",
"to",
"create",
"the",
"Main",
"class"
] | [
"'''\n Creates an arg parser and uses that to create the Main class\n '''",
"#narg='?',"
] | [
{
"param": "cls",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0241574d799369fc14e09032783d19ff00d9da10 | niosus/homework_checker | homework_checker/core/tests/test_task.py | [
"Apache-2.0"
] | Python | __sanitize_results | dict | def __sanitize_results(results: dict) -> dict:
"""Sanitize the outputs of the tasks."""
sanitized_results = {}
for key, value in results.items():
sanitized_results[tools.remove_number_from_name(key)] = value
return sanitized_results | Sanitize the outputs of the tasks. | Sanitize the outputs of the tasks. | [
"Sanitize",
"the",
"outputs",
"of",
"the",
"tasks",
"."
] | def __sanitize_results(results: dict) -> dict:
sanitized_results = {}
for key, value in results.items():
sanitized_results[tools.remove_number_from_name(key)] = value
return sanitized_results | [
"def",
"__sanitize_results",
"(",
"results",
":",
"dict",
")",
"->",
"dict",
":",
"sanitized_results",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"results",
".",
"items",
"(",
")",
":",
"sanitized_results",
"[",
"tools",
".",
"remove_number_from_name",... | Sanitize the outputs of the tasks. | [
"Sanitize",
"the",
"outputs",
"of",
"the",
"tasks",
"."
] | [
"\"\"\"Sanitize the outputs of the tasks.\"\"\""
] | [
{
"param": "results",
"type": "dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "results",
"type": "dict",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f3c4cfa84ed004344c6121f5eb4a493249f46418 | niosus/homework_checker | homework_checker/core/tasks.py | [
"Apache-2.0"
] | Python | from_yaml_node | Optional[Task] | def from_yaml_node(
task_node: dict, student_hw_folder: Path, job_file: Path
) -> Optional[Task]:
"""Create an Task appropriate for the language."""
student_task_folder = student_hw_folder / task_node[Tags.FOLDER_TAG]
if not student_task_folder.exists():
log.warning("Fold... | Create an Task appropriate for the language. | Create an Task appropriate for the language. | [
"Create",
"an",
"Task",
"appropriate",
"for",
"the",
"language",
"."
] | def from_yaml_node(
task_node: dict, student_hw_folder: Path, job_file: Path
) -> Optional[Task]:
student_task_folder = student_hw_folder / task_node[Tags.FOLDER_TAG]
if not student_task_folder.exists():
log.warning("Folder '%s' does not exist. Skipping.", student_task_folder)
... | [
"def",
"from_yaml_node",
"(",
"task_node",
":",
"dict",
",",
"student_hw_folder",
":",
"Path",
",",
"job_file",
":",
"Path",
")",
"->",
"Optional",
"[",
"Task",
"]",
":",
"student_task_folder",
"=",
"student_hw_folder",
"/",
"task_node",
"[",
"Tags",
".",
"F... | Create an Task appropriate for the language. | [
"Create",
"an",
"Task",
"appropriate",
"for",
"the",
"language",
"."
] | [
"\"\"\"Create an Task appropriate for the language.\"\"\""
] | [
{
"param": "task_node",
"type": "dict"
},
{
"param": "student_hw_folder",
"type": "Path"
},
{
"param": "job_file",
"type": "Path"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "task_node",
"type": "dict",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "student_hw_folder",
"type": "Path",
"docstring": null,
... |
f3c4cfa84ed004344c6121f5eb4a493249f46418 | niosus/homework_checker | homework_checker/core/tasks.py | [
"Apache-2.0"
] | Python | check | Task.ResultDictType | def check(self: Task) -> Task.ResultDictType:
"""Iterate over the tests and check them."""
# Generate empty results.
results: Task.ResultDictType = {}
def run_all_tests(
test_node: dict, executable_folder: Path
) -> Task.ResultDictType:
"""Run all tests i... | Iterate over the tests and check them. | Iterate over the tests and check them. | [
"Iterate",
"over",
"the",
"tests",
"and",
"check",
"them",
"."
] | def check(self: Task) -> Task.ResultDictType:
results: Task.ResultDictType = {}
def run_all_tests(
test_node: dict, executable_folder: Path
) -> Task.ResultDictType:
results: Task.ResultDictType = {}
if Tags.INJECT_FOLDER_TAG not in test_node:
... | [
"def",
"check",
"(",
"self",
":",
"Task",
")",
"->",
"Task",
".",
"ResultDictType",
":",
"results",
":",
"Task",
".",
"ResultDictType",
"=",
"{",
"}",
"def",
"run_all_tests",
"(",
"test_node",
":",
"dict",
",",
"executable_folder",
":",
"Path",
")",
"->"... | Iterate over the tests and check them. | [
"Iterate",
"over",
"the",
"tests",
"and",
"check",
"them",
"."
] | [
"\"\"\"Iterate over the tests and check them.\"\"\"",
"# Generate empty results.",
"\"\"\"Run all tests in the task.\"\"\"",
"# There is no need to rebuild the code. We can just run our tests.",
"# There are folders to inject, so we will have to rebuild with the newly",
"# injected folders. We do it in a ... | [
{
"param": "self",
"type": "Task"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": "Task",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f3c4cfa84ed004344c6121f5eb4a493249f46418 | niosus/homework_checker | homework_checker/core/tasks.py | [
"Apache-2.0"
] | Python | __inject_folders | null | def __inject_folders(folders_to_inject: List[Task.Injection]):
"""Inject all folders overwriting existing folders in case of conflict."""
for injection in folders_to_inject:
if injection.destination.exists():
rmtree(injection.destination)
copytree(injection.source... | Inject all folders overwriting existing folders in case of conflict. | Inject all folders overwriting existing folders in case of conflict. | [
"Inject",
"all",
"folders",
"overwriting",
"existing",
"folders",
"in",
"case",
"of",
"conflict",
"."
] | def __inject_folders(folders_to_inject: List[Task.Injection]):
for injection in folders_to_inject:
if injection.destination.exists():
rmtree(injection.destination)
copytree(injection.source, injection.destination) | [
"def",
"__inject_folders",
"(",
"folders_to_inject",
":",
"List",
"[",
"Task",
".",
"Injection",
"]",
")",
":",
"for",
"injection",
"in",
"folders_to_inject",
":",
"if",
"injection",
".",
"destination",
".",
"exists",
"(",
")",
":",
"rmtree",
"(",
"injection... | Inject all folders overwriting existing folders in case of conflict. | [
"Inject",
"all",
"folders",
"overwriting",
"existing",
"folders",
"in",
"case",
"of",
"conflict",
"."
] | [
"\"\"\"Inject all folders overwriting existing folders in case of conflict.\"\"\""
] | [
{
"param": "folders_to_inject",
"type": "List[Task.Injection]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "folders_to_inject",
"type": "List[Task.Injection]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f3c4cfa84ed004344c6121f5eb4a493249f46418 | niosus/homework_checker | homework_checker/core/tasks.py | [
"Apache-2.0"
] | Python | _code_style_errors | Optional[tools.CmdResult] | def _code_style_errors(self: CppTask) -> Optional[tools.CmdResult]:
"""Check if code conforms to Google Style."""
command = (
"cpplint --counting=detailed "
+ "--filter=-legal,-readability/todo,"
+ "-build/include_order,-runtime/threadsafe_fn,"
+ "-runtime... | Check if code conforms to Google Style. | Check if code conforms to Google Style. | [
"Check",
"if",
"code",
"conforms",
"to",
"Google",
"Style",
"."
] | def _code_style_errors(self: CppTask) -> Optional[tools.CmdResult]:
command = (
"cpplint --counting=detailed "
+ "--filter=-legal,-readability/todo,"
+ "-build/include_order,-runtime/threadsafe_fn,"
+ "-runtime/arrays"
+ ' $( find . -name "*.h" -o -nam... | [
"def",
"_code_style_errors",
"(",
"self",
":",
"CppTask",
")",
"->",
"Optional",
"[",
"tools",
".",
"CmdResult",
"]",
":",
"command",
"=",
"(",
"\"cpplint --counting=detailed \"",
"+",
"\"--filter=-legal,-readability/todo,\"",
"+",
"\"-build/include_order,-runtime/threads... | Check if code conforms to Google Style. | [
"Check",
"if",
"code",
"conforms",
"to",
"Google",
"Style",
"."
] | [
"\"\"\"Check if code conforms to Google Style.\"\"\""
] | [
{
"param": "self",
"type": "CppTask"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": "CppTask",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
85e5f25e687a3bf64dce7990c378a34266dcba0b | niosus/homework_checker | homework_checker/core/tools.py | [
"Apache-2.0"
] | Python | remove_number_from_name | str | def remove_number_from_name(name: str) -> str:
"""Add a number before a string."""
if NUMBER_SPLIT_TAG not in name:
return name
return name.split(NUMBER_SPLIT_TAG)[1] | Add a number before a string. | Add a number before a string. | [
"Add",
"a",
"number",
"before",
"a",
"string",
"."
] | def remove_number_from_name(name: str) -> str:
if NUMBER_SPLIT_TAG not in name:
return name
return name.split(NUMBER_SPLIT_TAG)[1] | [
"def",
"remove_number_from_name",
"(",
"name",
":",
"str",
")",
"->",
"str",
":",
"if",
"NUMBER_SPLIT_TAG",
"not",
"in",
"name",
":",
"return",
"name",
"return",
"name",
".",
"split",
"(",
"NUMBER_SPLIT_TAG",
")",
"[",
"1",
"]"
] | Add a number before a string. | [
"Add",
"a",
"number",
"before",
"a",
"string",
"."
] | [
"\"\"\"Add a number before a string.\"\"\""
] | [
{
"param": "name",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
85e5f25e687a3bf64dce7990c378a34266dcba0b | niosus/homework_checker | homework_checker/core/tools.py | [
"Apache-2.0"
] | Python | expand_if_needed | Path | def expand_if_needed(input_path: Path) -> Path:
"""Expand the path if it is not absolute."""
if input_path.is_absolute():
return input_path
new_path = input_path.expanduser()
if new_path.is_absolute():
# This path needed user expansion. Now that the user home directory is
# expan... | Expand the path if it is not absolute. | Expand the path if it is not absolute. | [
"Expand",
"the",
"path",
"if",
"it",
"is",
"not",
"absolute",
"."
] | def expand_if_needed(input_path: Path) -> Path:
if input_path.is_absolute():
return input_path
new_path = input_path.expanduser()
if new_path.is_absolute():
return new_path
return Path.cwd() / new_path | [
"def",
"expand_if_needed",
"(",
"input_path",
":",
"Path",
")",
"->",
"Path",
":",
"if",
"input_path",
".",
"is_absolute",
"(",
")",
":",
"return",
"input_path",
"new_path",
"=",
"input_path",
".",
"expanduser",
"(",
")",
"if",
"new_path",
".",
"is_absolute"... | Expand the path if it is not absolute. | [
"Expand",
"the",
"path",
"if",
"it",
"is",
"not",
"absolute",
"."
] | [
"\"\"\"Expand the path if it is not absolute.\"\"\"",
"# This path needed user expansion. Now that the user home directory is",
"# expanded this is a full absolute path.",
"# The user could not be expanded, so we assume it is just another relative",
"# path to the current working directory."
] | [
{
"param": "input_path",
"type": "Path"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_path",
"type": "Path",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
85e5f25e687a3bf64dce7990c378a34266dcba0b | niosus/homework_checker | homework_checker/core/tools.py | [
"Apache-2.0"
] | Python | convert_to | Union[Tuple[Optional[str], str], Tuple[Optional[float], str]] | def convert_to(
output_type: str, value: Any
) -> Union[Tuple[Optional[str], str], Tuple[Optional[float], str]]:
"""Convert the value to a specified type."""
if not value:
return None, "No value. Cannot convert {} to '{}'.".format(value, output_type)
try:
if output_type == OutputTags.STR... | Convert the value to a specified type. | Convert the value to a specified type. | [
"Convert",
"the",
"value",
"to",
"a",
"specified",
"type",
"."
] | def convert_to(
output_type: str, value: Any
) -> Union[Tuple[Optional[str], str], Tuple[Optional[float], str]]:
if not value:
return None, "No value. Cannot convert {} to '{}'.".format(value, output_type)
try:
if output_type == OutputTags.STRING:
return str(value).strip(), "OK"
... | [
"def",
"convert_to",
"(",
"output_type",
":",
"str",
",",
"value",
":",
"Any",
")",
"->",
"Union",
"[",
"Tuple",
"[",
"Optional",
"[",
"str",
"]",
",",
"str",
"]",
",",
"Tuple",
"[",
"Optional",
"[",
"float",
"]",
",",
"str",
"]",
"]",
":",
"if",... | Convert the value to a specified type. | [
"Convert",
"the",
"value",
"to",
"a",
"specified",
"type",
"."
] | [
"\"\"\"Convert the value to a specified type.\"\"\""
] | [
{
"param": "output_type",
"type": "str"
},
{
"param": "value",
"type": "Any"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "output_type",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "Any",
"docstring": null,
"docstring_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.