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
4623bc8aac6f5c832645d02582e2f3a3da0d1291
allen-cell-animated/simularium-conversion
simulariumio/md/md_converter.py
[ "Apache-2.0" ]
Python
_get_radius
float
def _get_radius(raw_type_name: str, input_data: MdData) -> float: """ Get the radius to use for the particle with the given raw_type_name """ if ( raw_type_name in input_data.display_data and input_data.display_data[raw_type_name].radius is not None ): ...
Get the radius to use for the particle with the given raw_type_name
Get the radius to use for the particle with the given raw_type_name
[ "Get", "the", "radius", "to", "use", "for", "the", "particle", "with", "the", "given", "raw_type_name" ]
def _get_radius(raw_type_name: str, input_data: MdData) -> float: if ( raw_type_name in input_data.display_data and input_data.display_data[raw_type_name].radius is not None ): return input_data.display_data[raw_type_name].radius element_type = guess_atom_elem...
[ "def", "_get_radius", "(", "raw_type_name", ":", "str", ",", "input_data", ":", "MdData", ")", "->", "float", ":", "if", "(", "raw_type_name", "in", "input_data", ".", "display_data", "and", "input_data", ".", "display_data", "[", "raw_type_name", "]", ".", ...
Get the radius to use for the particle with the given raw_type_name
[ "Get", "the", "radius", "to", "use", "for", "the", "particle", "with", "the", "given", "raw_type_name" ]
[ "\"\"\"\n Get the radius to use for the particle with the given raw_type_name\n \"\"\"" ]
[ { "param": "raw_type_name", "type": "str" }, { "param": "input_data", "type": "MdData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "raw_type_name", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "input_data", "type": "MdData", "docstring": null, "...
4623bc8aac6f5c832645d02582e2f3a3da0d1291
allen-cell-animated/simularium-conversion
simulariumio/md/md_converter.py
[ "Apache-2.0" ]
Python
_get_element_hex_color
str
def _get_element_hex_color(element_type: str, jmol_colors: pd.DataFrame) -> str: """ Get the standard Jmol hex color for the atomic element type """ element_df = jmol_colors.loc[jmol_colors["atom"] == element_type.title()] return "#" + str(element_df.Hex.values[0]) if not element...
Get the standard Jmol hex color for the atomic element type
Get the standard Jmol hex color for the atomic element type
[ "Get", "the", "standard", "Jmol", "hex", "color", "for", "the", "atomic", "element", "type" ]
def _get_element_hex_color(element_type: str, jmol_colors: pd.DataFrame) -> str: element_df = jmol_colors.loc[jmol_colors["atom"] == element_type.title()] return "#" + str(element_df.Hex.values[0]) if not element_df.empty else ""
[ "def", "_get_element_hex_color", "(", "element_type", ":", "str", ",", "jmol_colors", ":", "pd", ".", "DataFrame", ")", "->", "str", ":", "element_df", "=", "jmol_colors", ".", "loc", "[", "jmol_colors", "[", "\"atom\"", "]", "==", "element_type", ".", "titl...
Get the standard Jmol hex color for the atomic element type
[ "Get", "the", "standard", "Jmol", "hex", "color", "for", "the", "atomic", "element", "type" ]
[ "\"\"\"\n Get the standard Jmol hex color for the atomic element type\n \"\"\"" ]
[ { "param": "element_type", "type": "str" }, { "param": "jmol_colors", "type": "pd.DataFrame" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "element_type", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "jmol_colors", "type": "pd.DataFrame", "docstring": null, ...
4623bc8aac6f5c832645d02582e2f3a3da0d1291
allen-cell-animated/simularium-conversion
simulariumio/md/md_converter.py
[ "Apache-2.0" ]
Python
_get_display_data_for_type
DisplayData
def _get_display_data_for_type( raw_type_name: str, jmol_colors: pd.DataFrame, input_data: MdData ) -> DisplayData: """ Get the DisplayData with atomic element colors from Jmol """ element_type = guess_atom_element(raw_type_name) color = MdConverter._get_element_hex_c...
Get the DisplayData with atomic element colors from Jmol
Get the DisplayData with atomic element colors from Jmol
[ "Get", "the", "DisplayData", "with", "atomic", "element", "colors", "from", "Jmol" ]
def _get_display_data_for_type( raw_type_name: str, jmol_colors: pd.DataFrame, input_data: MdData ) -> DisplayData: element_type = guess_atom_element(raw_type_name) color = MdConverter._get_element_hex_color(element_type, jmol_colors) display_data = None if raw_type_name in i...
[ "def", "_get_display_data_for_type", "(", "raw_type_name", ":", "str", ",", "jmol_colors", ":", "pd", ".", "DataFrame", ",", "input_data", ":", "MdData", ")", "->", "DisplayData", ":", "element_type", "=", "guess_atom_element", "(", "raw_type_name", ")", "color", ...
Get the DisplayData with atomic element colors from Jmol
[ "Get", "the", "DisplayData", "with", "atomic", "element", "colors", "from", "Jmol" ]
[ "\"\"\"\n Get the DisplayData with atomic element colors from Jmol\n \"\"\"" ]
[ { "param": "raw_type_name", "type": "str" }, { "param": "jmol_colors", "type": "pd.DataFrame" }, { "param": "input_data", "type": "MdData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "raw_type_name", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "jmol_colors", "type": "pd.DataFrame", "docstring": null, ...
4623bc8aac6f5c832645d02582e2f3a3da0d1291
allen-cell-animated/simularium-conversion
simulariumio/md/md_converter.py
[ "Apache-2.0" ]
Python
_get_display_data_mapping
DisplayData
def _get_display_data_mapping( unique_raw_type_names: Set[str], input_data: MdData ) -> DisplayData: """ Get display names mapped to display data (geometry and color) """ result = {} jmol_colors = JMOL_COLORS() for raw_type_name in unique_raw_type_names: ...
Get display names mapped to display data (geometry and color)
Get display names mapped to display data (geometry and color)
[ "Get", "display", "names", "mapped", "to", "display", "data", "(", "geometry", "and", "color", ")" ]
def _get_display_data_mapping( unique_raw_type_names: Set[str], input_data: MdData ) -> DisplayData: result = {} jmol_colors = JMOL_COLORS() for raw_type_name in unique_raw_type_names: display_data = MdConverter._get_display_data_for_type( raw_type_name, j...
[ "def", "_get_display_data_mapping", "(", "unique_raw_type_names", ":", "Set", "[", "str", "]", ",", "input_data", ":", "MdData", ")", "->", "DisplayData", ":", "result", "=", "{", "}", "jmol_colors", "=", "JMOL_COLORS", "(", ")", "for", "raw_type_name", "in", ...
Get display names mapped to display data (geometry and color)
[ "Get", "display", "names", "mapped", "to", "display", "data", "(", "geometry", "and", "color", ")" ]
[ "\"\"\"\n Get display names mapped to display data (geometry and color)\n \"\"\"" ]
[ { "param": "unique_raw_type_names", "type": "Set[str]" }, { "param": "input_data", "type": "MdData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "unique_raw_type_names", "type": "Set[str]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "input_data", "type": "MdData", "docstring": ...
4623bc8aac6f5c832645d02582e2f3a3da0d1291
allen-cell-animated/simularium-conversion
simulariumio/md/md_converter.py
[ "Apache-2.0" ]
Python
_read_universe
AgentData
def _read_universe( input_data: MdData, ) -> AgentData: """ Use a MD Universe to get AgentData """ dimensions = MdConverter._read_universe_dimensions(input_data) result = AgentData.from_dimensions(dimensions) get_type_name_func = np.frompyfunc(MdConverter._get...
Use a MD Universe to get AgentData
Use a MD Universe to get AgentData
[ "Use", "a", "MD", "Universe", "to", "get", "AgentData" ]
def _read_universe( input_data: MdData, ) -> AgentData: dimensions = MdConverter._read_universe_dimensions(input_data) result = AgentData.from_dimensions(dimensions) get_type_name_func = np.frompyfunc(MdConverter._get_type_name, 2, 1) unique_raw_type_names = set([]) t...
[ "def", "_read_universe", "(", "input_data", ":", "MdData", ",", ")", "->", "AgentData", ":", "dimensions", "=", "MdConverter", ".", "_read_universe_dimensions", "(", "input_data", ")", "result", "=", "AgentData", ".", "from_dimensions", "(", "dimensions", ")", "...
Use a MD Universe to get AgentData
[ "Use", "a", "MD", "Universe", "to", "get", "AgentData" ]
[ "\"\"\"\n Use a MD Universe to get AgentData\n \"\"\"" ]
[ { "param": "input_data", "type": "MdData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_data", "type": "MdData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4623bc8aac6f5c832645d02582e2f3a3da0d1291
allen-cell-animated/simularium-conversion
simulariumio/md/md_converter.py
[ "Apache-2.0" ]
Python
_read
TrajectoryData
def _read(input_data: MdData) -> TrajectoryData: """ Return a TrajectoryData object containing the MD data """ print("Reading MD Data -------------") # get data from the MD Universe agent_data = MdConverter._read_universe(input_data) # create TrajectoryData ...
Return a TrajectoryData object containing the MD data
Return a TrajectoryData object containing the MD data
[ "Return", "a", "TrajectoryData", "object", "containing", "the", "MD", "data" ]
def _read(input_data: MdData) -> TrajectoryData: print("Reading MD Data -------------") agent_data = MdConverter._read_universe(input_data) input_data.spatial_units.multiply(1.0 / input_data.meta_data.scale_factor) input_data.meta_data._set_box_size() return TrajectoryData( ...
[ "def", "_read", "(", "input_data", ":", "MdData", ")", "->", "TrajectoryData", ":", "print", "(", "\"Reading MD Data -------------\"", ")", "agent_data", "=", "MdConverter", ".", "_read_universe", "(", "input_data", ")", "input_data", ".", "spatial_units", ".", "m...
Return a TrajectoryData object containing the MD data
[ "Return", "a", "TrajectoryData", "object", "containing", "the", "MD", "data" ]
[ "\"\"\"\n Return a TrajectoryData object containing the MD data\n \"\"\"", "# get data from the MD Universe", "# create TrajectoryData" ]
[ { "param": "input_data", "type": "MdData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_data", "type": "MdData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f9112594611adae6a5ebbd7a9bb5354cc433ac5e
allen-cell-animated/simularium-conversion
simulariumio/data_objects/agent_data.py
[ "Apache-2.0" ]
Python
_get_buffer_data_dimensions
DimensionData
def _get_buffer_data_dimensions(buffer_data: Dict[str, Any]) -> DimensionData: """ Get dimensions of a simularium JSON dict containing buffers """ bundle_data = buffer_data["spatialData"]["bundleData"] result = DimensionData(total_steps=len(bundle_data), max_agents=0) for...
Get dimensions of a simularium JSON dict containing buffers
Get dimensions of a simularium JSON dict containing buffers
[ "Get", "dimensions", "of", "a", "simularium", "JSON", "dict", "containing", "buffers" ]
def _get_buffer_data_dimensions(buffer_data: Dict[str, Any]) -> DimensionData: bundle_data = buffer_data["spatialData"]["bundleData"] result = DimensionData(total_steps=len(bundle_data), max_agents=0) for time_index in range(result.total_steps): buffer = bundle_data[time_index]["data...
[ "def", "_get_buffer_data_dimensions", "(", "buffer_data", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "DimensionData", ":", "bundle_data", "=", "buffer_data", "[", "\"spatialData\"", "]", "[", "\"bundleData\"", "]", "result", "=", "DimensionData", "(", ...
Get dimensions of a simularium JSON dict containing buffers
[ "Get", "dimensions", "of", "a", "simularium", "JSON", "dict", "containing", "buffers" ]
[ "\"\"\"\n Get dimensions of a simularium JSON dict containing buffers\n \"\"\"", "# buffer = packed agent data as a list of numbers", "# a new agent should start at this index", "# get the number of subpoints" ]
[ { "param": "buffer_data", "type": "Dict[str, Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "buffer_data", "type": "Dict[str, Any]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f9112594611adae6a5ebbd7a9bb5354cc433ac5e
allen-cell-animated/simularium-conversion
simulariumio/data_objects/agent_data.py
[ "Apache-2.0" ]
Python
from_buffer_data
<not_specific>
def from_buffer_data(cls, buffer_data: Dict[str, Any]): """ Create AgentData from a simularium JSON dict containing buffers """ bundle_data = buffer_data["spatialData"]["bundleData"] dimensions = AgentData._get_buffer_data_dimensions(buffer_data) print(f"original dim = {d...
Create AgentData from a simularium JSON dict containing buffers
Create AgentData from a simularium JSON dict containing buffers
[ "Create", "AgentData", "from", "a", "simularium", "JSON", "dict", "containing", "buffers" ]
def from_buffer_data(cls, buffer_data: Dict[str, Any]): bundle_data = buffer_data["spatialData"]["bundleData"] dimensions = AgentData._get_buffer_data_dimensions(buffer_data) print(f"original dim = {dimensions}") agent_data = AgentData.from_dimensions(dimensions) type_ids = np.ze...
[ "def", "from_buffer_data", "(", "cls", ",", "buffer_data", ":", "Dict", "[", "str", ",", "Any", "]", ")", ":", "bundle_data", "=", "buffer_data", "[", "\"spatialData\"", "]", "[", "\"bundleData\"", "]", "dimensions", "=", "AgentData", ".", "_get_buffer_data_di...
Create AgentData from a simularium JSON dict containing buffers
[ "Create", "AgentData", "from", "a", "simularium", "JSON", "dict", "containing", "buffers" ]
[ "\"\"\"\n Create AgentData from a simularium JSON dict containing buffers\n \"\"\"", "# a new agent should start at this index", "# get the subpoints" ]
[ { "param": "cls", "type": null }, { "param": "buffer_data", "type": "Dict[str, Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "buffer_data", "type": "Dict[str, Any]", "docstring": null, "do...
f9112594611adae6a5ebbd7a9bb5354cc433ac5e
allen-cell-animated/simularium-conversion
simulariumio/data_objects/agent_data.py
[ "Apache-2.0" ]
Python
from_dataframe
<not_specific>
def from_dataframe(cls, traj: pd.DataFrame): """ Create AgentData from a pandas DataFrame with columns: time, unique_id, type, positionX, positionY, positionZ, radius (only for default agents, no fibers) """ times = np.unique(traj.loc[0, "time"].to_numpy()) n_agen...
Create AgentData from a pandas DataFrame with columns: time, unique_id, type, positionX, positionY, positionZ, radius (only for default agents, no fibers)
Create AgentData from a pandas DataFrame with columns: time, unique_id, type, positionX, positionY, positionZ, radius (only for default agents, no fibers)
[ "Create", "AgentData", "from", "a", "pandas", "DataFrame", "with", "columns", ":", "time", "unique_id", "type", "positionX", "positionY", "positionZ", "radius", "(", "only", "for", "default", "agents", "no", "fibers", ")" ]
def from_dataframe(cls, traj: pd.DataFrame): times = np.unique(traj.loc[0, "time"].to_numpy()) n_agents = np.squeeze( traj.groupby("time").agg(["count"])["unique_id"].to_numpy() ) grouped_traj = ( traj.set_index(["time", traj.groupby("time").cumcount()]) ...
[ "def", "from_dataframe", "(", "cls", ",", "traj", ":", "pd", ".", "DataFrame", ")", ":", "times", "=", "np", ".", "unique", "(", "traj", ".", "loc", "[", "0", ",", "\"time\"", "]", ".", "to_numpy", "(", ")", ")", "n_agents", "=", "np", ".", "sque...
Create AgentData from a pandas DataFrame with columns: time, unique_id, type, positionX, positionY, positionZ, radius (only for default agents, no fibers)
[ "Create", "AgentData", "from", "a", "pandas", "DataFrame", "with", "columns", ":", "time", "unique_id", "type", "positionX", "positionY", "positionZ", "radius", "(", "only", "for", "default", "agents", "no", "fibers", ")" ]
[ "\"\"\"\n Create AgentData from a pandas DataFrame with columns:\n time, unique_id, type, positionX, positionY, positionZ, radius\n (only for default agents, no fibers)\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "traj", "type": "pd.DataFrame" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "traj", "type": "pd.DataFrame", "docstring": null, "docstring_t...
f9112594611adae6a5ebbd7a9bb5354cc433ac5e
allen-cell-animated/simularium-conversion
simulariumio/data_objects/agent_data.py
[ "Apache-2.0" ]
Python
from_dimensions
<not_specific>
def from_dimensions( cls, dimensions: DimensionData, default_viz_type: float = VIZ_TYPE.DEFAULT ): """ Create AgentData with empty numpy arrays of the required dimensions """ return cls( times=np.zeros(dimensions.total_steps), n_agents=np.zeros(dimensi...
Create AgentData with empty numpy arrays of the required dimensions
Create AgentData with empty numpy arrays of the required dimensions
[ "Create", "AgentData", "with", "empty", "numpy", "arrays", "of", "the", "required", "dimensions" ]
def from_dimensions( cls, dimensions: DimensionData, default_viz_type: float = VIZ_TYPE.DEFAULT ): return cls( times=np.zeros(dimensions.total_steps), n_agents=np.zeros(dimensions.total_steps), viz_types=default_viz_type * np.ones((dimensions.total_ste...
[ "def", "from_dimensions", "(", "cls", ",", "dimensions", ":", "DimensionData", ",", "default_viz_type", ":", "float", "=", "VIZ_TYPE", ".", "DEFAULT", ")", ":", "return", "cls", "(", "times", "=", "np", ".", "zeros", "(", "dimensions", ".", "total_steps", ...
Create AgentData with empty numpy arrays of the required dimensions
[ "Create", "AgentData", "with", "empty", "numpy", "arrays", "of", "the", "required", "dimensions" ]
[ "\"\"\"\n Create AgentData with empty numpy arrays of the required dimensions\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "dimensions", "type": "DimensionData" }, { "param": "default_viz_type", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dimensions", "type": "DimensionData", "docstring": null, "docs...
f9112594611adae6a5ebbd7a9bb5354cc433ac5e
allen-cell-animated/simularium-conversion
simulariumio/data_objects/agent_data.py
[ "Apache-2.0" ]
Python
check_increase_buffer_size
AgentData
def check_increase_buffer_size( self, next_index: int, axis: int = 1, buffer_size_inc: DimensionData = BUFFER_SIZE_INC, ) -> AgentData: """ If needed for the next_index to fit in the arrays, create a copy of this object with the size of the numpy arrays increa...
If needed for the next_index to fit in the arrays, create a copy of this object with the size of the numpy arrays increased by the buffer_size_inc
If needed for the next_index to fit in the arrays, create a copy of this object with the size of the numpy arrays increased by the buffer_size_inc
[ "If", "needed", "for", "the", "next_index", "to", "fit", "in", "the", "arrays", "create", "a", "copy", "of", "this", "object", "with", "the", "size", "of", "the", "numpy", "arrays", "increased", "by", "the", "buffer_size_inc" ]
def check_increase_buffer_size( self, next_index: int, axis: int = 1, buffer_size_inc: DimensionData = BUFFER_SIZE_INC, ) -> AgentData: result = self if axis == 0: while next_index >= result.get_dimensions().total_steps: result = result.g...
[ "def", "check_increase_buffer_size", "(", "self", ",", "next_index", ":", "int", ",", "axis", ":", "int", "=", "1", ",", "buffer_size_inc", ":", "DimensionData", "=", "BUFFER_SIZE_INC", ",", ")", "->", "AgentData", ":", "result", "=", "self", "if", "axis", ...
If needed for the next_index to fit in the arrays, create a copy of this object with the size of the numpy arrays increased by the buffer_size_inc
[ "If", "needed", "for", "the", "next_index", "to", "fit", "in", "the", "arrays", "create", "a", "copy", "of", "this", "object", "with", "the", "size", "of", "the", "numpy", "arrays", "increased", "by", "the", "buffer_size_inc" ]
[ "\"\"\"\n If needed for the next_index to fit in the arrays, create a copy of this object\n with the size of the numpy arrays increased by the buffer_size_inc\n \"\"\"", "# time dimension", "# agents dimension", "# subpoints dimension" ]
[ { "param": "self", "type": null }, { "param": "next_index", "type": "int" }, { "param": "axis", "type": "int" }, { "param": "buffer_size_inc", "type": "DimensionData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "next_index", "type": "int", "docstring": null, "docstring_tok...
2306e9808589acb6e2c69d7b740c76825308cd66
allen-cell-animated/simularium-conversion
simulariumio/filters/multiply_space_filter.py
[ "Apache-2.0" ]
Python
apply
TrajectoryData
def apply(self, data: TrajectoryData) -> TrajectoryData: """ Multiply spatial values in the data """ print( f"Filtering: multiplying spatial scale by {self.multiplier} -------------" ) data.meta_data.box_size = self.multiplier * data.meta_data.box_size ...
Multiply spatial values in the data
Multiply spatial values in the data
[ "Multiply", "spatial", "values", "in", "the", "data" ]
def apply(self, data: TrajectoryData) -> TrajectoryData: print( f"Filtering: multiplying spatial scale by {self.multiplier} -------------" ) data.meta_data.box_size = self.multiplier * data.meta_data.box_size data.agent_data.positions = self.multiplier * data.agent_data.posit...
[ "def", "apply", "(", "self", ",", "data", ":", "TrajectoryData", ")", "->", "TrajectoryData", ":", "print", "(", "f\"Filtering: multiplying spatial scale by {self.multiplier} -------------\"", ")", "data", ".", "meta_data", ".", "box_size", "=", "self", ".", "multipli...
Multiply spatial values in the data
[ "Multiply", "spatial", "values", "in", "the", "data" ]
[ "\"\"\"\n Multiply spatial values in the data\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "data", "type": "TrajectoryData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "TrajectoryData", "docstring": null, "docstrin...
c182c912bf16735236348867d4d7a7712732be2e
allen-cell-animated/simularium-conversion
simulariumio/filters/translate_filter.py
[ "Apache-2.0" ]
Python
apply
TrajectoryData
def apply(self, data: TrajectoryData) -> TrajectoryData: """ Add the XYZ translation to all spatial coordinates """ print("Filtering: translation -------------") # get dimensions total_steps = data.agent_data.times.size max_agents = int(np.amax(data.agent_data.n_a...
Add the XYZ translation to all spatial coordinates
Add the XYZ translation to all spatial coordinates
[ "Add", "the", "XYZ", "translation", "to", "all", "spatial", "coordinates" ]
def apply(self, data: TrajectoryData) -> TrajectoryData: print("Filtering: translation -------------") total_steps = data.agent_data.times.size max_agents = int(np.amax(data.agent_data.n_agents)) max_subpoints = int(np.amax(data.agent_data.n_subpoints)) positions = np.zeros((tota...
[ "def", "apply", "(", "self", ",", "data", ":", "TrajectoryData", ")", "->", "TrajectoryData", ":", "print", "(", "\"Filtering: translation -------------\"", ")", "total_steps", "=", "data", ".", "agent_data", ".", "times", ".", "size", "max_agents", "=", "int", ...
Add the XYZ translation to all spatial coordinates
[ "Add", "the", "XYZ", "translation", "to", "all", "spatial", "coordinates" ]
[ "\"\"\"\n Add the XYZ translation to all spatial coordinates\n \"\"\"", "# get dimensions", "# get filtered data" ]
[ { "param": "self", "type": null }, { "param": "data", "type": "TrajectoryData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "TrajectoryData", "docstring": null, "docstrin...
f36d2aa7e0559572aba2ae5b3601cde981da0ff8
allen-cell-animated/simularium-conversion
simulariumio/plot_readers/histogram_plot_reader.py
[ "Apache-2.0" ]
Python
read
Dict[str, Any]
def read(self, data: Dict[str, Any]) -> Dict[str, Any]: """ Return an object containing the data shaped for Simularium format """ print("Reading Histogram Data -------------") simularium_data = {} # layout info simularium_data["layout"] = { "title": da...
Return an object containing the data shaped for Simularium format
Return an object containing the data shaped for Simularium format
[ "Return", "an", "object", "containing", "the", "data", "shaped", "for", "Simularium", "format" ]
def read(self, data: Dict[str, Any]) -> Dict[str, Any]: print("Reading Histogram Data -------------") simularium_data = {} simularium_data["layout"] = { "title": data.title, "xaxis": {"title": data.xaxis_title}, "yaxis": {"title": "frequency"}, } ...
[ "def", "read", "(", "self", ",", "data", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "print", "(", "\"Reading Histogram Data -------------\"", ")", "simularium_data", "=", "{", "}", "simularium_data", "[...
Return an object containing the data shaped for Simularium format
[ "Return", "an", "object", "containing", "the", "data", "shaped", "for", "Simularium", "format" ]
[ "\"\"\"\n Return an object containing the data shaped for Simularium format\n \"\"\"", "# layout info", "# plot data" ]
[ { "param": "self", "type": null }, { "param": "data", "type": "Dict[str, Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "Dict[str, Any]", "docstring": null, "docstrin...
721e4080cf5fcbb2f15c8bbfe392d30b69bbc809
allen-cell-animated/simularium-conversion
simulariumio/data_objects/display_data.py
[ "Apache-2.0" ]
Python
is_default
<not_specific>
def is_default(self): """ Check if this DisplayData is only holding default data """ return ( self.display_type == DISPLAY_TYPE.NONE and not self.url and not self.color )
Check if this DisplayData is only holding default data
Check if this DisplayData is only holding default data
[ "Check", "if", "this", "DisplayData", "is", "only", "holding", "default", "data" ]
def is_default(self): return ( self.display_type == DISPLAY_TYPE.NONE and not self.url and not self.color )
[ "def", "is_default", "(", "self", ")", ":", "return", "(", "self", ".", "display_type", "==", "DISPLAY_TYPE", ".", "NONE", "and", "not", "self", ".", "url", "and", "not", "self", ".", "color", ")" ]
Check if this DisplayData is only holding default data
[ "Check", "if", "this", "DisplayData", "is", "only", "holding", "default", "data" ]
[ "\"\"\"\n Check if this DisplayData is only holding default data\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
721e4080cf5fcbb2f15c8bbfe392d30b69bbc809
allen-cell-animated/simularium-conversion
simulariumio/data_objects/display_data.py
[ "Apache-2.0" ]
Python
check_set_default_display_type
<not_specific>
def check_set_default_display_type(self, has_subpoints): """ If the display type hasn't been specified, set it to a default based on whether the agent has subpoints """ if self.display_type != DISPLAY_TYPE.NONE: return self.display_type = DISPLAY_TYPE.FIBER if...
If the display type hasn't been specified, set it to a default based on whether the agent has subpoints
If the display type hasn't been specified, set it to a default based on whether the agent has subpoints
[ "If", "the", "display", "type", "hasn", "'", "t", "been", "specified", "set", "it", "to", "a", "default", "based", "on", "whether", "the", "agent", "has", "subpoints" ]
def check_set_default_display_type(self, has_subpoints): if self.display_type != DISPLAY_TYPE.NONE: return self.display_type = DISPLAY_TYPE.FIBER if has_subpoints else DISPLAY_TYPE.SPHERE
[ "def", "check_set_default_display_type", "(", "self", ",", "has_subpoints", ")", ":", "if", "self", ".", "display_type", "!=", "DISPLAY_TYPE", ".", "NONE", ":", "return", "self", ".", "display_type", "=", "DISPLAY_TYPE", ".", "FIBER", "if", "has_subpoints", "els...
If the display type hasn't been specified, set it to a default based on whether the agent has subpoints
[ "If", "the", "display", "type", "hasn", "'", "t", "been", "specified", "set", "it", "to", "a", "default", "based", "on", "whether", "the", "agent", "has", "subpoints" ]
[ "\"\"\"\n If the display type hasn't been specified, set it to a default\n based on whether the agent has subpoints\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "has_subpoints", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "has_subpoints", "type": null, "docstring": null, "docstring_t...
097b40a98f462106cf11872a1d432cda9412ca68
allen-cell-animated/simularium-conversion
simulariumio/filters/every_nth_subpoint_filter.py
[ "Apache-2.0" ]
Python
apply
TrajectoryData
def apply(self, data: TrajectoryData) -> TrajectoryData: """ Reduce the number of subpoints in each frame of the simularium data by filtering out all but every nth subpoint """ print("Filtering: every Nth subpoint -------------") # get dimensions total_steps = dat...
Reduce the number of subpoints in each frame of the simularium data by filtering out all but every nth subpoint
Reduce the number of subpoints in each frame of the simularium data by filtering out all but every nth subpoint
[ "Reduce", "the", "number", "of", "subpoints", "in", "each", "frame", "of", "the", "simularium", "data", "by", "filtering", "out", "all", "but", "every", "nth", "subpoint" ]
def apply(self, data: TrajectoryData) -> TrajectoryData: print("Filtering: every Nth subpoint -------------") total_steps = data.agent_data.times.size max_agents = int(np.amax(data.agent_data.n_agents)) max_subpoints = int(np.amax(data.agent_data.n_subpoints)) n_subpoints = np.ze...
[ "def", "apply", "(", "self", ",", "data", ":", "TrajectoryData", ")", "->", "TrajectoryData", ":", "print", "(", "\"Filtering: every Nth subpoint -------------\"", ")", "total_steps", "=", "data", ".", "agent_data", ".", "times", ".", "size", "max_agents", "=", ...
Reduce the number of subpoints in each frame of the simularium data by filtering out all but every nth subpoint
[ "Reduce", "the", "number", "of", "subpoints", "in", "each", "frame", "of", "the", "simularium", "data", "by", "filtering", "out", "all", "but", "every", "nth", "subpoint" ]
[ "\"\"\"\n Reduce the number of subpoints in each frame of the simularium\n data by filtering out all but every nth subpoint\n \"\"\"", "# get dimensions", "# get filtered data" ]
[ { "param": "self", "type": null }, { "param": "data", "type": "TrajectoryData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "TrajectoryData", "docstring": null, "docstrin...
1f90a999fd2a88e99a306a92012f873acb6b6048
allen-cell-animated/simularium-conversion
simulariumio/filters/every_nth_timestep_filter.py
[ "Apache-2.0" ]
Python
apply
TrajectoryData
def apply(self, data: TrajectoryData) -> TrajectoryData: """ Reduce the number of timesteps in each frame of the simularium data by filtering out all but every nth timestep """ print(f"Filtering: every {self.n}th timestep -------------") if self.n < 2: raise E...
Reduce the number of timesteps in each frame of the simularium data by filtering out all but every nth timestep
Reduce the number of timesteps in each frame of the simularium data by filtering out all but every nth timestep
[ "Reduce", "the", "number", "of", "timesteps", "in", "each", "frame", "of", "the", "simularium", "data", "by", "filtering", "out", "all", "but", "every", "nth", "timestep" ]
def apply(self, data: TrajectoryData) -> TrajectoryData: print(f"Filtering: every {self.n}th timestep -------------") if self.n < 2: raise Exception("N < 2: no timesteps will be filtered") new_dimensions = DimensionData( total_steps=int(math.ceil(data.agent_data.times.siz...
[ "def", "apply", "(", "self", ",", "data", ":", "TrajectoryData", ")", "->", "TrajectoryData", ":", "print", "(", "f\"Filtering: every {self.n}th timestep -------------\"", ")", "if", "self", ".", "n", "<", "2", ":", "raise", "Exception", "(", "\"N < 2: no timestep...
Reduce the number of timesteps in each frame of the simularium data by filtering out all but every nth timestep
[ "Reduce", "the", "number", "of", "timesteps", "in", "each", "frame", "of", "the", "simularium", "data", "by", "filtering", "out", "all", "but", "every", "nth", "timestep" ]
[ "\"\"\"\n Reduce the number of timesteps in each frame of the simularium\n data by filtering out all but every nth timestep\n \"\"\"", "# get filtered dimensions", "# get filtered data" ]
[ { "param": "self", "type": null }, { "param": "data", "type": "TrajectoryData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "TrajectoryData", "docstring": null, "docstrin...
c1b0d97c7e3eedba5fdd4b42cd63ff506ec2c18d
allen-cell-animated/simularium-conversion
simulariumio/trajectory_converter.py
[ "Apache-2.0" ]
Python
_read_trajectory_data
Dict[str, Any]
def _read_trajectory_data(input_data: TrajectoryData) -> Dict[str, Any]: """ Return an object containing the data shaped for Simularium format """ print("Converting Trajectory Data -------------") inconsistent_type = TrajectoryConverter._check_types_match_subpoints(input_data) ...
Return an object containing the data shaped for Simularium format
Return an object containing the data shaped for Simularium format
[ "Return", "an", "object", "containing", "the", "data", "shaped", "for", "Simularium", "format" ]
def _read_trajectory_data(input_data: TrajectoryData) -> Dict[str, Any]: print("Converting Trajectory Data -------------") inconsistent_type = TrajectoryConverter._check_types_match_subpoints(input_data) if inconsistent_type: raise DataError(inconsistent_type) simularium_data...
[ "def", "_read_trajectory_data", "(", "input_data", ":", "TrajectoryData", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "print", "(", "\"Converting Trajectory Data -------------\"", ")", "inconsistent_type", "=", "TrajectoryConverter", ".", "_check_types_match_su...
Return an object containing the data shaped for Simularium format
[ "Return", "an", "object", "containing", "the", "data", "shaped", "for", "Simularium", "format" ]
[ "\"\"\"\n Return an object containing the data shaped for Simularium format\n \"\"\"", "# trajectory info", "# add any paper metadata", "# spatial data", "# plot data" ]
[ { "param": "input_data", "type": "TrajectoryData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_data", "type": "TrajectoryData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c1b0d97c7e3eedba5fdd4b42cd63ff506ec2c18d
allen-cell-animated/simularium-conversion
simulariumio/trajectory_converter.py
[ "Apache-2.0" ]
Python
_get_spatial_bundle_data_subpoints
List[Dict[str, Any]]
def _get_spatial_bundle_data_subpoints( agent_data: AgentData, type_ids: np.ndarray, ) -> List[Dict[str, Any]]: """ Return the spatialData's bundleData for a simulation of agents with subpoints, packing buffer with jagged data is slower """ bundle_data = [] ...
Return the spatialData's bundleData for a simulation of agents with subpoints, packing buffer with jagged data is slower
Return the spatialData's bundleData for a simulation of agents with subpoints, packing buffer with jagged data is slower
[ "Return", "the", "spatialData", "'", "s", "bundleData", "for", "a", "simulation", "of", "agents", "with", "subpoints", "packing", "buffer", "with", "jagged", "data", "is", "slower" ]
def _get_spatial_bundle_data_subpoints( agent_data: AgentData, type_ids: np.ndarray, ) -> List[Dict[str, Any]]: bundle_data = [] uids = {} used_unique_IDs = list(np.unique(agent_data.unique_ids)) total_steps = ( agent_data.n_timesteps if agent_...
[ "def", "_get_spatial_bundle_data_subpoints", "(", "agent_data", ":", "AgentData", ",", "type_ids", ":", "np", ".", "ndarray", ",", ")", "->", "List", "[", "Dict", "[", "str", ",", "Any", "]", "]", ":", "bundle_data", "=", "[", "]", "uids", "=", "{", "}...
Return the spatialData's bundleData for a simulation of agents with subpoints, packing buffer with jagged data is slower
[ "Return", "the", "spatialData", "'", "s", "bundleData", "for", "a", "simulation", "of", "agents", "with", "subpoints", "packing", "buffer", "with", "jagged", "data", "is", "slower" ]
[ "\"\"\"\n Return the spatialData's bundleData for a simulation\n of agents with subpoints, packing buffer with jagged data is slower\n \"\"\"", "# timestep", "# add agent", "# add subpoints to fiber agent", "# optionally draw spheres at points", "# every other fiber point", "# uniqu...
[ { "param": "agent_data", "type": "AgentData" }, { "param": "type_ids", "type": "np.ndarray" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "agent_data", "type": "AgentData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type_ids", "type": "np.ndarray", "docstring": null, ...
c1b0d97c7e3eedba5fdd4b42cd63ff506ec2c18d
allen-cell-animated/simularium-conversion
simulariumio/trajectory_converter.py
[ "Apache-2.0" ]
Python
_get_spatial_bundle_data_no_subpoints
List[Dict[str, Any]]
def _get_spatial_bundle_data_no_subpoints( agent_data: AgentData, type_ids: np.ndarray, ) -> List[Dict[str, Any]]: """ Return the spatialData's bundleData for a simulation of agents without subpoints, using list slicing for speed """ bundle_data = [] m...
Return the spatialData's bundleData for a simulation of agents without subpoints, using list slicing for speed
Return the spatialData's bundleData for a simulation of agents without subpoints, using list slicing for speed
[ "Return", "the", "spatialData", "'", "s", "bundleData", "for", "a", "simulation", "of", "agents", "without", "subpoints", "using", "list", "slicing", "for", "speed" ]
def _get_spatial_bundle_data_no_subpoints( agent_data: AgentData, type_ids: np.ndarray, ) -> List[Dict[str, Any]]: bundle_data = [] max_n_agents = int(np.amax(agent_data.n_agents, 0)) ix_positions = np.empty((3 * max_n_agents,), dtype=int) ix_rotations = np.empty((3 *...
[ "def", "_get_spatial_bundle_data_no_subpoints", "(", "agent_data", ":", "AgentData", ",", "type_ids", ":", "np", ".", "ndarray", ",", ")", "->", "List", "[", "Dict", "[", "str", ",", "Any", "]", "]", ":", "bundle_data", "=", "[", "]", "max_n_agents", "=", ...
Return the spatialData's bundleData for a simulation of agents without subpoints, using list slicing for speed
[ "Return", "the", "spatialData", "'", "s", "bundleData", "for", "a", "simulation", "of", "agents", "without", "subpoints", "using", "list", "slicing", "for", "speed" ]
[ "\"\"\"\n Return the spatialData's bundleData for a simulation\n of agents without subpoints, using list slicing for speed\n \"\"\"" ]
[ { "param": "agent_data", "type": "AgentData" }, { "param": "type_ids", "type": "np.ndarray" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "agent_data", "type": "AgentData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type_ids", "type": "np.ndarray", "docstring": null, ...
c1b0d97c7e3eedba5fdd4b42cd63ff506ec2c18d
allen-cell-animated/simularium-conversion
simulariumio/trajectory_converter.py
[ "Apache-2.0" ]
Python
_check_agent_ids_are_unique_per_frame
bool
def _check_agent_ids_are_unique_per_frame(buffer_data: Dict[str, Any]) -> bool: """ For each frame, check that none of the unique agent IDs overlap """ bundle_data = buffer_data["spatialData"]["bundleData"] for time_index in range(len(bundle_data)): data = bundle_data...
For each frame, check that none of the unique agent IDs overlap
For each frame, check that none of the unique agent IDs overlap
[ "For", "each", "frame", "check", "that", "none", "of", "the", "unique", "agent", "IDs", "overlap" ]
def _check_agent_ids_are_unique_per_frame(buffer_data: Dict[str, Any]) -> bool: bundle_data = buffer_data["spatialData"]["bundleData"] for time_index in range(len(bundle_data)): data = bundle_data[time_index]["data"] agent_index = 1 uids = [] get_n_subpoin...
[ "def", "_check_agent_ids_are_unique_per_frame", "(", "buffer_data", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "bool", ":", "bundle_data", "=", "buffer_data", "[", "\"spatialData\"", "]", "[", "\"bundleData\"", "]", "for", "time_index", "in", "range", ...
For each frame, check that none of the unique agent IDs overlap
[ "For", "each", "frame", "check", "that", "none", "of", "the", "unique", "agent", "IDs", "overlap" ]
[ "\"\"\"\n For each frame, check that none of the unique agent IDs overlap\n \"\"\"", "# get the number of subpoints", "# in order to correctly increment index", "# there should be a unique ID at this index, check for duplicate" ]
[ { "param": "buffer_data", "type": "Dict[str, Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "buffer_data", "type": "Dict[str, Any]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c1b0d97c7e3eedba5fdd4b42cd63ff506ec2c18d
allen-cell-animated/simularium-conversion
simulariumio/trajectory_converter.py
[ "Apache-2.0" ]
Python
_check_type_matches_subpoints
str
def _check_type_matches_subpoints( type_name: str, n_subpoints: int, viz_type: float, display_data: DisplayData, debug_name: str = "", ) -> str: """ If the agent has subpoints, check that it also has a display_type of "FIBER" and viz type of "FIBER", a...
If the agent has subpoints, check that it also has a display_type of "FIBER" and viz type of "FIBER", and vice versa. return a message saying what is inconsistent
If the agent has subpoints, check that it also has a display_type of "FIBER" and viz type of "FIBER", and vice versa. return a message saying what is inconsistent
[ "If", "the", "agent", "has", "subpoints", "check", "that", "it", "also", "has", "a", "display_type", "of", "\"", "FIBER", "\"", "and", "viz", "type", "of", "\"", "FIBER", "\"", "and", "vice", "versa", ".", "return", "a", "message", "saying", "what", "i...
def _check_type_matches_subpoints( type_name: str, n_subpoints: int, viz_type: float, display_data: DisplayData, debug_name: str = "", ) -> str: has_subpoints = n_subpoints > 0 msg = ( f"Agent {debug_name}: Type {type_name} " + ("has" i...
[ "def", "_check_type_matches_subpoints", "(", "type_name", ":", "str", ",", "n_subpoints", ":", "int", ",", "viz_type", ":", "float", ",", "display_data", ":", "DisplayData", ",", "debug_name", ":", "str", "=", "\"\"", ",", ")", "->", "str", ":", "has_subpoin...
If the agent has subpoints, check that it also has a display_type of "FIBER" and viz type of "FIBER", and vice versa.
[ "If", "the", "agent", "has", "subpoints", "check", "that", "it", "also", "has", "a", "display_type", "of", "\"", "FIBER", "\"", "and", "viz", "type", "of", "\"", "FIBER", "\"", "and", "vice", "versa", "." ]
[ "\"\"\"\n If the agent has subpoints, check that it\n also has a display_type of \"FIBER\" and viz type of \"FIBER\", and vice versa.\n return a message saying what is inconsistent\n \"\"\"" ]
[ { "param": "type_name", "type": "str" }, { "param": "n_subpoints", "type": "int" }, { "param": "viz_type", "type": "float" }, { "param": "display_data", "type": "DisplayData" }, { "param": "debug_name", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "type_name", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "n_subpoints", "type": "int", "docstring": null, "docstr...
c1b0d97c7e3eedba5fdd4b42cd63ff506ec2c18d
allen-cell-animated/simularium-conversion
simulariumio/trajectory_converter.py
[ "Apache-2.0" ]
Python
_check_types_match_subpoints
str
def _check_types_match_subpoints(trajectory_data: TrajectoryData) -> str: """ For each frame, check that agents that have subpoints also have a display_type of "FIBER" and viz type of "FIBER", and vice versa. return a message with the type name of the first agent that is inconsistent ...
For each frame, check that agents that have subpoints also have a display_type of "FIBER" and viz type of "FIBER", and vice versa. return a message with the type name of the first agent that is inconsistent
For each frame, check that agents that have subpoints also have a display_type of "FIBER" and viz type of "FIBER", and vice versa. return a message with the type name of the first agent that is inconsistent
[ "For", "each", "frame", "check", "that", "agents", "that", "have", "subpoints", "also", "have", "a", "display_type", "of", "\"", "FIBER", "\"", "and", "viz", "type", "of", "\"", "FIBER", "\"", "and", "vice", "versa", ".", "return", "a", "message", "with"...
def _check_types_match_subpoints(trajectory_data: TrajectoryData) -> str: n_subpoints = trajectory_data.agent_data.n_subpoints display_data = trajectory_data.agent_data.display_data for time_index in range(n_subpoints.shape[0]): for agent_index in range( int(trajector...
[ "def", "_check_types_match_subpoints", "(", "trajectory_data", ":", "TrajectoryData", ")", "->", "str", ":", "n_subpoints", "=", "trajectory_data", ".", "agent_data", ".", "n_subpoints", "display_data", "=", "trajectory_data", ".", "agent_data", ".", "display_data", "...
For each frame, check that agents that have subpoints also have a display_type of "FIBER" and viz type of "FIBER", and vice versa.
[ "For", "each", "frame", "check", "that", "agents", "that", "have", "subpoints", "also", "have", "a", "display_type", "of", "\"", "FIBER", "\"", "and", "viz", "type", "of", "\"", "FIBER", "\"", "and", "vice", "versa", "." ]
[ "\"\"\"\n For each frame, check that agents that have subpoints\n also have a display_type of \"FIBER\" and viz type of \"FIBER\", and vice versa.\n return a message with the type name of the first agent that is inconsistent\n \"\"\"" ]
[ { "param": "trajectory_data", "type": "TrajectoryData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "trajectory_data", "type": "TrajectoryData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c1b0d97c7e3eedba5fdd4b42cd63ff506ec2c18d
allen-cell-animated/simularium-conversion
simulariumio/trajectory_converter.py
[ "Apache-2.0" ]
Python
_determine_plot_reader
[PlotReader]
def _determine_plot_reader(plot_type: str = "scatter") -> [PlotReader]: """ Return the plot reader to match the requested plot type """ if plot_type in SUPPORTED_PLOT_READERS: return SUPPORTED_PLOT_READERS[plot_type] raise UnsupportedPlotTypeError(plot_type)
Return the plot reader to match the requested plot type
Return the plot reader to match the requested plot type
[ "Return", "the", "plot", "reader", "to", "match", "the", "requested", "plot", "type" ]
def _determine_plot_reader(plot_type: str = "scatter") -> [PlotReader]: if plot_type in SUPPORTED_PLOT_READERS: return SUPPORTED_PLOT_READERS[plot_type] raise UnsupportedPlotTypeError(plot_type)
[ "def", "_determine_plot_reader", "(", "plot_type", ":", "str", "=", "\"scatter\"", ")", "->", "[", "PlotReader", "]", ":", "if", "plot_type", "in", "SUPPORTED_PLOT_READERS", ":", "return", "SUPPORTED_PLOT_READERS", "[", "plot_type", "]", "raise", "UnsupportedPlotTyp...
Return the plot reader to match the requested plot type
[ "Return", "the", "plot", "reader", "to", "match", "the", "requested", "plot", "type" ]
[ "\"\"\"\n Return the plot reader to match the requested plot type\n \"\"\"" ]
[ { "param": "plot_type", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "plot_type", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c1b0d97c7e3eedba5fdd4b42cd63ff506ec2c18d
allen-cell-animated/simularium-conversion
simulariumio/trajectory_converter.py
[ "Apache-2.0" ]
Python
add_plot
null
def add_plot( self, data: [ScatterPlotData or HistogramPlotData], plot_type: str = "scatter", ): """ Add data to be rendered in a plot Parameters ---------- data: ScatterPlotData or HistogramPlotData Loaded data for a plot. plot_ty...
Add data to be rendered in a plot Parameters ---------- data: ScatterPlotData or HistogramPlotData Loaded data for a plot. plot_type: str A string specifying which type of plot to render. Current options: 'scatter' : a scatter...
Add data to be rendered in a plot Parameters ScatterPlotData or HistogramPlotData Loaded data for a plot. plot_type: str A string specifying which type of plot to render.
[ "Add", "data", "to", "be", "rendered", "in", "a", "plot", "Parameters", "ScatterPlotData", "or", "HistogramPlotData", "Loaded", "data", "for", "a", "plot", ".", "plot_type", ":", "str", "A", "string", "specifying", "which", "type", "of", "plot", "to", "rende...
def add_plot( self, data: [ScatterPlotData or HistogramPlotData], plot_type: str = "scatter", ): plot_reader_class = self._determine_plot_reader(plot_type) self._data.plots.append(plot_reader_class().read(data))
[ "def", "add_plot", "(", "self", ",", "data", ":", "[", "ScatterPlotData", "or", "HistogramPlotData", "]", ",", "plot_type", ":", "str", "=", "\"scatter\"", ",", ")", ":", "plot_reader_class", "=", "self", ".", "_determine_plot_reader", "(", "plot_type", ")", ...
Add data to be rendered in a plot Parameters
[ "Add", "data", "to", "be", "rendered", "in", "a", "plot", "Parameters" ]
[ "\"\"\"\n Add data to be rendered in a plot\n\n Parameters\n ----------\n data: ScatterPlotData or HistogramPlotData\n Loaded data for a plot.\n plot_type: str\n A string specifying which type of plot to render.\n Current options:\n ...
[ { "param": "self", "type": null }, { "param": "data", "type": "[ScatterPlotData or HistogramPlotData]" }, { "param": "plot_type", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "[ScatterPlotData or HistogramPlotData]", "docstring...
c1b0d97c7e3eedba5fdd4b42cd63ff506ec2c18d
allen-cell-animated/simularium-conversion
simulariumio/trajectory_converter.py
[ "Apache-2.0" ]
Python
add_number_of_agents_plot
null
def add_number_of_agents_plot( self, plot_title: str = "Number of agents over time", yaxis_title: str = "Number of agents", ): """ Add a scatterplot of the number of each type of agent over time Parameters ---------- agent_data: AgentData ...
Add a scatterplot of the number of each type of agent over time Parameters ---------- agent_data: AgentData The data shaped as an AgentData object Default: None (use the currently loaded data)
Add a scatterplot of the number of each type of agent over time Parameters AgentData The data shaped as an AgentData object Default: None (use the currently loaded data)
[ "Add", "a", "scatterplot", "of", "the", "number", "of", "each", "type", "of", "agent", "over", "time", "Parameters", "AgentData", "The", "data", "shaped", "as", "an", "AgentData", "object", "Default", ":", "None", "(", "use", "the", "currently", "loaded", ...
def add_number_of_agents_plot( self, plot_title: str = "Number of agents over time", yaxis_title: str = "Number of agents", ): n_agents = {} for time_index in range(self._data.agent_data.times.size): for agent_index in range(int(self._data.agent_data.n_agents[time...
[ "def", "add_number_of_agents_plot", "(", "self", ",", "plot_title", ":", "str", "=", "\"Number of agents over time\"", ",", "yaxis_title", ":", "str", "=", "\"Number of agents\"", ",", ")", ":", "n_agents", "=", "{", "}", "for", "time_index", "in", "range", "(",...
Add a scatterplot of the number of each type of agent over time Parameters
[ "Add", "a", "scatterplot", "of", "the", "number", "of", "each", "type", "of", "agent", "over", "time", "Parameters" ]
[ "\"\"\"\n Add a scatterplot of the number of each type of agent over time\n\n Parameters\n ----------\n agent_data: AgentData\n The data shaped as an AgentData object\n Default: None (use the currently loaded data)\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "plot_title", "type": "str" }, { "param": "yaxis_title", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "plot_title", "type": "str", "docstring": null, "docstring_tok...
c1b0d97c7e3eedba5fdd4b42cd63ff506ec2c18d
allen-cell-animated/simularium-conversion
simulariumio/trajectory_converter.py
[ "Apache-2.0" ]
Python
filter_data
TrajectoryData
def filter_data(self, filters: List[Filter]) -> TrajectoryData: """ Return the simularium data with the given filter applied """ filtered_data = copy.deepcopy(self._data) for f in filters: filtered_data = f.apply(filtered_data) return filtered_data
Return the simularium data with the given filter applied
Return the simularium data with the given filter applied
[ "Return", "the", "simularium", "data", "with", "the", "given", "filter", "applied" ]
def filter_data(self, filters: List[Filter]) -> TrajectoryData: filtered_data = copy.deepcopy(self._data) for f in filters: filtered_data = f.apply(filtered_data) return filtered_data
[ "def", "filter_data", "(", "self", ",", "filters", ":", "List", "[", "Filter", "]", ")", "->", "TrajectoryData", ":", "filtered_data", "=", "copy", ".", "deepcopy", "(", "self", ".", "_data", ")", "for", "f", "in", "filters", ":", "filtered_data", "=", ...
Return the simularium data with the given filter applied
[ "Return", "the", "simularium", "data", "with", "the", "given", "filter", "applied" ]
[ "\"\"\"\n Return the simularium data with the given filter applied\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "filters", "type": "List[Filter]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filters", "type": "List[Filter]", "docstring": null, "docstri...
c1b0d97c7e3eedba5fdd4b42cd63ff506ec2c18d
allen-cell-animated/simularium-conversion
simulariumio/trajectory_converter.py
[ "Apache-2.0" ]
Python
to_JSON
<not_specific>
def to_JSON(self): """ Return the current simularium data in JSON format """ buffer_data = TrajectoryConverter._read_trajectory_data(self._data) return json.dumps(buffer_data)
Return the current simularium data in JSON format
Return the current simularium data in JSON format
[ "Return", "the", "current", "simularium", "data", "in", "JSON", "format" ]
def to_JSON(self): buffer_data = TrajectoryConverter._read_trajectory_data(self._data) return json.dumps(buffer_data)
[ "def", "to_JSON", "(", "self", ")", ":", "buffer_data", "=", "TrajectoryConverter", ".", "_read_trajectory_data", "(", "self", ".", "_data", ")", "return", "json", ".", "dumps", "(", "buffer_data", ")" ]
Return the current simularium data in JSON format
[ "Return", "the", "current", "simularium", "data", "in", "JSON", "format" ]
[ "\"\"\"\n Return the current simularium data in JSON format\n\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c1b0d97c7e3eedba5fdd4b42cd63ff506ec2c18d
allen-cell-animated/simularium-conversion
simulariumio/trajectory_converter.py
[ "Apache-2.0" ]
Python
write_JSON
null
def write_JSON(self, output_path: str): """ Save the current simularium data in .simularium JSON format at the output path Parameters ---------- output_path: str where to save the file """ print("Writing JSON -------------") buffer_dat...
Save the current simularium data in .simularium JSON format at the output path Parameters ---------- output_path: str where to save the file
Save the current simularium data in .simularium JSON format at the output path Parameters str where to save the file
[ "Save", "the", "current", "simularium", "data", "in", ".", "simularium", "JSON", "format", "at", "the", "output", "path", "Parameters", "str", "where", "to", "save", "the", "file" ]
def write_JSON(self, output_path: str): print("Writing JSON -------------") buffer_data = TrajectoryConverter._read_trajectory_data(self._data) with open(f"{output_path}.simularium", "w+") as outfile: json.dump(buffer_data, outfile) print(f"saved to {output_path}.simularium")
[ "def", "write_JSON", "(", "self", ",", "output_path", ":", "str", ")", ":", "print", "(", "\"Writing JSON -------------\"", ")", "buffer_data", "=", "TrajectoryConverter", ".", "_read_trajectory_data", "(", "self", ".", "_data", ")", "with", "open", "(", "f\"{ou...
Save the current simularium data in .simularium JSON format at the output path
[ "Save", "the", "current", "simularium", "data", "in", ".", "simularium", "JSON", "format", "at", "the", "output", "path" ]
[ "\"\"\"\n Save the current simularium data in .simularium JSON format\n at the output path\n\n Parameters\n ----------\n output_path: str\n where to save the file\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "output_path", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "output_path", "type": "str", "docstring": null, "docstring_to...
c1b0d97c7e3eedba5fdd4b42cd63ff506ec2c18d
allen-cell-animated/simularium-conversion
simulariumio/trajectory_converter.py
[ "Apache-2.0" ]
Python
write_external_JSON
null
def write_external_JSON(external_data: TrajectoryData, output_path: str): """ Save the given data in .simularium JSON format at the output path Parameters ---------- external_data: TrajectoryData the data to save output_path: str where to ...
Save the given data in .simularium JSON format at the output path Parameters ---------- external_data: TrajectoryData the data to save output_path: str where to save the file
Save the given data in .simularium JSON format at the output path Parameters TrajectoryData the data to save output_path: str where to save the file
[ "Save", "the", "given", "data", "in", ".", "simularium", "JSON", "format", "at", "the", "output", "path", "Parameters", "TrajectoryData", "the", "data", "to", "save", "output_path", ":", "str", "where", "to", "save", "the", "file" ]
def write_external_JSON(external_data: TrajectoryData, output_path: str): print("Writing JSON (external)-------------") buffer_data = TrajectoryConverter._read_trajectory_data(external_data) with open(f"{output_path}.simularium", "w+") as outfile: json.dump(buffer_data, outfile) ...
[ "def", "write_external_JSON", "(", "external_data", ":", "TrajectoryData", ",", "output_path", ":", "str", ")", ":", "print", "(", "\"Writing JSON (external)-------------\"", ")", "buffer_data", "=", "TrajectoryConverter", ".", "_read_trajectory_data", "(", "external_data...
Save the given data in .simularium JSON format at the output path
[ "Save", "the", "given", "data", "in", ".", "simularium", "JSON", "format", "at", "the", "output", "path" ]
[ "\"\"\"\n Save the given data in .simularium JSON format\n at the output path\n\n Parameters\n ----------\n external_data: TrajectoryData\n the data to save\n output_path: str\n where to save the file\n \"\"\"" ]
[ { "param": "external_data", "type": "TrajectoryData" }, { "param": "output_path", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "external_data", "type": "TrajectoryData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "output_path", "type": "str", "docstring": null...
c3e2d7ed8da8b60c4da4ff982cf04ef5d96c3438
allen-cell-animated/simularium-conversion
simulariumio/plot_readers/scatter_plot_reader.py
[ "Apache-2.0" ]
Python
read
Dict[str, Any]
def read(self, data: Dict[str, Any]) -> Dict[str, Any]: """ Return an object containing the data shaped for Simularium format """ print("Reading Scatter Plot Data -------------") simularium_data = {} # layout info simularium_data["layout"] = { "title":...
Return an object containing the data shaped for Simularium format
Return an object containing the data shaped for Simularium format
[ "Return", "an", "object", "containing", "the", "data", "shaped", "for", "Simularium", "format" ]
def read(self, data: Dict[str, Any]) -> Dict[str, Any]: print("Reading Scatter Plot Data -------------") simularium_data = {} simularium_data["layout"] = { "title": data.title, "xaxis": {"title": data.xaxis_title}, "yaxis": {"title": data.yaxis_title}, ...
[ "def", "read", "(", "self", ",", "data", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "print", "(", "\"Reading Scatter Plot Data -------------\"", ")", "simularium_data", "=", "{", "}", "simularium_data", ...
Return an object containing the data shaped for Simularium format
[ "Return", "an", "object", "containing", "the", "data", "shaped", "for", "Simularium", "format" ]
[ "\"\"\"\n Return an object containing the data shaped for Simularium format\n \"\"\"", "# layout info", "# plot data" ]
[ { "param": "self", "type": null }, { "param": "data", "type": "Dict[str, Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "Dict[str, Any]", "docstring": null, "docstrin...
e1bc3a4ce8da35f832e1fd5ed2a1d3815c22fde2
allen-cell-animated/simularium-conversion
simulariumio/data_objects/model_meta_data.py
[ "Apache-2.0" ]
Python
from_buffer_data
<not_specific>
def from_buffer_data(cls, buffer_data: Dict[str, Any]): """ Create ModelMetaData from a simularium JSON dict containing buffers """ model_info = ( buffer_data["trajectoryInfo"]["modelInfo"] if "modelInfo" in buffer_data["trajectoryInfo"] else None ...
Create ModelMetaData from a simularium JSON dict containing buffers
Create ModelMetaData from a simularium JSON dict containing buffers
[ "Create", "ModelMetaData", "from", "a", "simularium", "JSON", "dict", "containing", "buffers" ]
def from_buffer_data(cls, buffer_data: Dict[str, Any]): model_info = ( buffer_data["trajectoryInfo"]["modelInfo"] if "modelInfo" in buffer_data["trajectoryInfo"] else None ) if model_info is None: return cls() return cls( title=...
[ "def", "from_buffer_data", "(", "cls", ",", "buffer_data", ":", "Dict", "[", "str", ",", "Any", "]", ")", ":", "model_info", "=", "(", "buffer_data", "[", "\"trajectoryInfo\"", "]", "[", "\"modelInfo\"", "]", "if", "\"modelInfo\"", "in", "buffer_data", "[", ...
Create ModelMetaData from a simularium JSON dict containing buffers
[ "Create", "ModelMetaData", "from", "a", "simularium", "JSON", "dict", "containing", "buffers" ]
[ "\"\"\"\n Create ModelMetaData from a simularium JSON dict containing buffers\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "buffer_data", "type": "Dict[str, Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "buffer_data", "type": "Dict[str, Any]", "docstring": null, "do...
e1bc3a4ce8da35f832e1fd5ed2a1d3815c22fde2
allen-cell-animated/simularium-conversion
simulariumio/data_objects/model_meta_data.py
[ "Apache-2.0" ]
Python
is_default
<not_specific>
def is_default(self): """ Check if this ModelMetaData is only holding default data """ return ( not self.title and not self.version and not self.authors and not self.description and not self.doi and not self.source_c...
Check if this ModelMetaData is only holding default data
Check if this ModelMetaData is only holding default data
[ "Check", "if", "this", "ModelMetaData", "is", "only", "holding", "default", "data" ]
def is_default(self): return ( not self.title and not self.version and not self.authors and not self.description and not self.doi and not self.source_code_url and not self.source_code_license_url and not self.input_d...
[ "def", "is_default", "(", "self", ")", ":", "return", "(", "not", "self", ".", "title", "and", "not", "self", ".", "version", "and", "not", "self", ".", "authors", "and", "not", "self", ".", "description", "and", "not", "self", ".", "doi", "and", "no...
Check if this ModelMetaData is only holding default data
[ "Check", "if", "this", "ModelMetaData", "is", "only", "holding", "default", "data" ]
[ "\"\"\"\n Check if this ModelMetaData is only holding default data\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0524a9b9263cf063080634a46af73c94a2f851ac
allen-cell-animated/simularium-conversion
simulariumio/filters/multiply_time_filter.py
[ "Apache-2.0" ]
Python
apply
TrajectoryData
def apply(self, data: TrajectoryData) -> TrajectoryData: """ Multiply time values in the data """ print(f"Filtering: multiplying time by {self.multiplier} -------------") # plot data if self.apply_to_plots: for plot in range(len(data.plots)): x...
Multiply time values in the data
Multiply time values in the data
[ "Multiply", "time", "values", "in", "the", "data" ]
def apply(self, data: TrajectoryData) -> TrajectoryData: print(f"Filtering: multiplying time by {self.multiplier} -------------") if self.apply_to_plots: for plot in range(len(data.plots)): x_title = data.plots[plot]["layout"]["xaxis"]["title"] if "time" not i...
[ "def", "apply", "(", "self", ",", "data", ":", "TrajectoryData", ")", "->", "TrajectoryData", ":", "print", "(", "f\"Filtering: multiplying time by {self.multiplier} -------------\"", ")", "if", "self", ".", "apply_to_plots", ":", "for", "plot", "in", "range", "(", ...
Multiply time values in the data
[ "Multiply", "time", "values", "in", "the", "data" ]
[ "\"\"\"\n Multiply time values in the data\n \"\"\"", "# plot data", "# spatial data" ]
[ { "param": "self", "type": null }, { "param": "data", "type": "TrajectoryData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "TrajectoryData", "docstring": null, "docstrin...
fac6814060f7ab8b9e70a5e9aec7cb1b9b45d2b4
allen-cell-animated/simularium-conversion
simulariumio/medyan/medyan_converter.py
[ "Apache-2.0" ]
Python
_draw_endpoints
bool
def _draw_endpoints(line: str, object_type: str, input_data: MedyanData) -> bool: """ Parse a line of a MEDYAN snapshot.traj output file and determine whether to also draw the endpoints as spheres """ if object_type == "motor" or object_type == "linker": type_name = M...
Parse a line of a MEDYAN snapshot.traj output file and determine whether to also draw the endpoints as spheres
Parse a line of a MEDYAN snapshot.traj output file and determine whether to also draw the endpoints as spheres
[ "Parse", "a", "line", "of", "a", "MEDYAN", "snapshot", ".", "traj", "output", "file", "and", "determine", "whether", "to", "also", "draw", "the", "endpoints", "as", "spheres" ]
def _draw_endpoints(line: str, object_type: str, input_data: MedyanData) -> bool: if object_type == "motor" or object_type == "linker": type_name = MedyanConverter._get_output_type_name( line, object_type, input_data ) if type_name in input_data.agents_with_en...
[ "def", "_draw_endpoints", "(", "line", ":", "str", ",", "object_type", ":", "str", ",", "input_data", ":", "MedyanData", ")", "->", "bool", ":", "if", "object_type", "==", "\"motor\"", "or", "object_type", "==", "\"linker\"", ":", "type_name", "=", "MedyanCo...
Parse a line of a MEDYAN snapshot.traj output file and determine whether to also draw the endpoints as spheres
[ "Parse", "a", "line", "of", "a", "MEDYAN", "snapshot", ".", "traj", "output", "file", "and", "determine", "whether", "to", "also", "draw", "the", "endpoints", "as", "spheres" ]
[ "\"\"\"\n Parse a line of a MEDYAN snapshot.traj output file\n and determine whether to also draw the endpoints as spheres\n \"\"\"" ]
[ { "param": "line", "type": "str" }, { "param": "object_type", "type": "str" }, { "param": "input_data", "type": "MedyanData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "line", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "object_type", "type": "str", "docstring": null, "docstring_t...
fac6814060f7ab8b9e70a5e9aec7cb1b9b45d2b4
allen-cell-animated/simularium-conversion
simulariumio/medyan/medyan_converter.py
[ "Apache-2.0" ]
Python
_get_output_type_name
bool
def _get_output_type_name( line: str, object_type: str, input_data: MedyanData ) -> bool: """ Parse a line of a MEDYAN snapshot.traj output file and return the type name to display for this agent type """ raw_tid = int(line.split()[2]) return ( inp...
Parse a line of a MEDYAN snapshot.traj output file and return the type name to display for this agent type
Parse a line of a MEDYAN snapshot.traj output file and return the type name to display for this agent type
[ "Parse", "a", "line", "of", "a", "MEDYAN", "snapshot", ".", "traj", "output", "file", "and", "return", "the", "type", "name", "to", "display", "for", "this", "agent", "type" ]
def _get_output_type_name( line: str, object_type: str, input_data: MedyanData ) -> bool: raw_tid = int(line.split()[2]) return ( input_data.display_data[object_type][raw_tid].name if raw_tid in input_data.display_data[object_type] else object_type + str(r...
[ "def", "_get_output_type_name", "(", "line", ":", "str", ",", "object_type", ":", "str", ",", "input_data", ":", "MedyanData", ")", "->", "bool", ":", "raw_tid", "=", "int", "(", "line", ".", "split", "(", ")", "[", "2", "]", ")", "return", "(", "inp...
Parse a line of a MEDYAN snapshot.traj output file and return the type name to display for this agent type
[ "Parse", "a", "line", "of", "a", "MEDYAN", "snapshot", ".", "traj", "output", "file", "and", "return", "the", "type", "name", "to", "display", "for", "this", "agent", "type" ]
[ "\"\"\"\n Parse a line of a MEDYAN snapshot.traj output file\n and return the type name to display for this agent type\n \"\"\"" ]
[ { "param": "line", "type": "str" }, { "param": "object_type", "type": "str" }, { "param": "input_data", "type": "MedyanData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "line", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "object_type", "type": "str", "docstring": null, "docstring_t...
fac6814060f7ab8b9e70a5e9aec7cb1b9b45d2b4
allen-cell-animated/simularium-conversion
simulariumio/medyan/medyan_converter.py
[ "Apache-2.0" ]
Python
_parse_data_dimensions
DimensionData
def _parse_data_dimensions( lines: List[str], input_data: MedyanData ) -> DimensionData: """ Parse a MEDYAN snapshot.traj output file to get the number of subpoints per agent per timestep """ result = DimensionData(0, 0) agents = 0 at_frame_start = Tru...
Parse a MEDYAN snapshot.traj output file to get the number of subpoints per agent per timestep
Parse a MEDYAN snapshot.traj output file to get the number of subpoints per agent per timestep
[ "Parse", "a", "MEDYAN", "snapshot", ".", "traj", "output", "file", "to", "get", "the", "number", "of", "subpoints", "per", "agent", "per", "timestep" ]
def _parse_data_dimensions( lines: List[str], input_data: MedyanData ) -> DimensionData: result = DimensionData(0, 0) agents = 0 at_frame_start = True for line in lines: if len(line) < 1: at_frame_start = True continue i...
[ "def", "_parse_data_dimensions", "(", "lines", ":", "List", "[", "str", "]", ",", "input_data", ":", "MedyanData", ")", "->", "DimensionData", ":", "result", "=", "DimensionData", "(", "0", ",", "0", ")", "agents", "=", "0", "at_frame_start", "=", "True", ...
Parse a MEDYAN snapshot.traj output file to get the number of subpoints per agent per timestep
[ "Parse", "a", "MEDYAN", "snapshot", ".", "traj", "output", "file", "to", "get", "the", "number", "of", "subpoints", "per", "agent", "per", "timestep" ]
[ "\"\"\"\n Parse a MEDYAN snapshot.traj output file to get the number\n of subpoints per agent per timestep\n \"\"\"", "# start of timestep", "# start of object", "# start of filament", "# start of linker or motor" ]
[ { "param": "lines", "type": "List[str]" }, { "param": "input_data", "type": "MedyanData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "lines", "type": "List[str]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "input_data", "type": "MedyanData", "docstring": null, ...
fac6814060f7ab8b9e70a5e9aec7cb1b9b45d2b4
allen-cell-animated/simularium-conversion
simulariumio/medyan/medyan_converter.py
[ "Apache-2.0" ]
Python
_get_trajectory_data
AgentData
def _get_trajectory_data(input_data: MedyanData) -> AgentData: """ Parse a MEDYAN snapshot.traj output file to get agents """ lines = input_data.snapshot_file.get_contents().split("\n") dimensions = MedyanConverter._parse_data_dimensions(lines, input_data) result = AgentD...
Parse a MEDYAN snapshot.traj output file to get agents
Parse a MEDYAN snapshot.traj output file to get agents
[ "Parse", "a", "MEDYAN", "snapshot", ".", "traj", "output", "file", "to", "get", "agents" ]
def _get_trajectory_data(input_data: MedyanData) -> AgentData: lines = input_data.snapshot_file.get_contents().split("\n") dimensions = MedyanConverter._parse_data_dimensions(lines, input_data) result = AgentData.from_dimensions(dimensions) time_index = -1 at_frame_start = True ...
[ "def", "_get_trajectory_data", "(", "input_data", ":", "MedyanData", ")", "->", "AgentData", ":", "lines", "=", "input_data", ".", "snapshot_file", ".", "get_contents", "(", ")", ".", "split", "(", "\"\\n\"", ")", "dimensions", "=", "MedyanConverter", ".", "_p...
Parse a MEDYAN snapshot.traj output file to get agents
[ "Parse", "a", "MEDYAN", "snapshot", ".", "traj", "output", "file", "to", "get", "agents" ]
[ "\"\"\"\n Parse a MEDYAN snapshot.traj output file to get agents\n \"\"\"", "# start of timestep", "# start of object", "# unique instance ID", "# type ID", "# type name", "# radius", "# draw endpoints?", "# object coordinates" ]
[ { "param": "input_data", "type": "MedyanData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_data", "type": "MedyanData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fac6814060f7ab8b9e70a5e9aec7cb1b9b45d2b4
allen-cell-animated/simularium-conversion
simulariumio/medyan/medyan_converter.py
[ "Apache-2.0" ]
Python
_read
TrajectoryData
def _read(input_data: MedyanData) -> TrajectoryData: """ Return an object containing the data shaped for Simularium format """ print("Reading MEDYAN Data -------------") agent_data = MedyanConverter._get_trajectory_data(input_data) # get display data (geometry and color) ...
Return an object containing the data shaped for Simularium format
Return an object containing the data shaped for Simularium format
[ "Return", "an", "object", "containing", "the", "data", "shaped", "for", "Simularium", "format" ]
def _read(input_data: MedyanData) -> TrajectoryData: print("Reading MEDYAN Data -------------") agent_data = MedyanConverter._get_trajectory_data(input_data) for object_type in input_data.display_data: for tid in input_data.display_data[object_type]: display_data = in...
[ "def", "_read", "(", "input_data", ":", "MedyanData", ")", "->", "TrajectoryData", ":", "print", "(", "\"Reading MEDYAN Data -------------\"", ")", "agent_data", "=", "MedyanConverter", ".", "_get_trajectory_data", "(", "input_data", ")", "for", "object_type", "in", ...
Return an object containing the data shaped for Simularium format
[ "Return", "an", "object", "containing", "the", "data", "shaped", "for", "Simularium", "format" ]
[ "\"\"\"\n Return an object containing the data shaped for Simularium format\n \"\"\"", "# get display data (geometry and color)" ]
[ { "param": "input_data", "type": "MedyanData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_data", "type": "MedyanData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9048232521115e8b440d8897940b2b8ffa7bdd94
allen-cell-animated/simularium-conversion
simulariumio/physicell/physicell_converter.py
[ "Apache-2.0" ]
Python
_load_data
np.ndarray
def _load_data(path_to_output_dir: str, nth_timestep_to_read: int) -> np.ndarray: """ Load simulation data from PhysiCell MultiCellDS XML files """ files = Path(path_to_output_dir).glob("*output*.xml") file_mapping = {} for f in files: index = int(f.name[f.nam...
Load simulation data from PhysiCell MultiCellDS XML files
Load simulation data from PhysiCell MultiCellDS XML files
[ "Load", "simulation", "data", "from", "PhysiCell", "MultiCellDS", "XML", "files" ]
def _load_data(path_to_output_dir: str, nth_timestep_to_read: int) -> np.ndarray: files = Path(path_to_output_dir).glob("*output*.xml") file_mapping = {} for f in files: index = int(f.name[f.name.index("output") + 6 :].split(".")[0]) if index % nth_timestep_to_read == 0: ...
[ "def", "_load_data", "(", "path_to_output_dir", ":", "str", ",", "nth_timestep_to_read", ":", "int", ")", "->", "np", ".", "ndarray", ":", "files", "=", "Path", "(", "path_to_output_dir", ")", ".", "glob", "(", "\"*output*.xml\"", ")", "file_mapping", "=", "...
Load simulation data from PhysiCell MultiCellDS XML files
[ "Load", "simulation", "data", "from", "PhysiCell", "MultiCellDS", "XML", "files" ]
[ "\"\"\"\n Load simulation data from PhysiCell MultiCellDS XML files\n \"\"\"" ]
[ { "param": "path_to_output_dir", "type": "str" }, { "param": "nth_timestep_to_read", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path_to_output_dir", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "nth_timestep_to_read", "type": "int", "docstring": n...
9048232521115e8b440d8897940b2b8ffa7bdd94
allen-cell-animated/simularium-conversion
simulariumio/physicell/physicell_converter.py
[ "Apache-2.0" ]
Python
_get_agent_type
int
def _get_agent_type( cell_type: int, cell_phase: int, input_data: PhysicellData, ids: Dict[int, Dict[int, int]], last_id: int, type_mapping: Dict[int, str], ) -> int: """ Get a unique agent type ID for a specific cell type and phase combination ...
Get a unique agent type ID for a specific cell type and phase combination
Get a unique agent type ID for a specific cell type and phase combination
[ "Get", "a", "unique", "agent", "type", "ID", "for", "a", "specific", "cell", "type", "and", "phase", "combination" ]
def _get_agent_type( cell_type: int, cell_phase: int, input_data: PhysicellData, ids: Dict[int, Dict[int, int]], last_id: int, type_mapping: Dict[int, str], ) -> int: if cell_type not in ids: ids[cell_type] = {} if cell_phase not in ids[cel...
[ "def", "_get_agent_type", "(", "cell_type", ":", "int", ",", "cell_phase", ":", "int", ",", "input_data", ":", "PhysicellData", ",", "ids", ":", "Dict", "[", "int", ",", "Dict", "[", "int", ",", "int", "]", "]", ",", "last_id", ":", "int", ",", "type...
Get a unique agent type ID for a specific cell type and phase combination
[ "Get", "a", "unique", "agent", "type", "ID", "for", "a", "specific", "cell", "type", "and", "phase", "combination" ]
[ "\"\"\"\n Get a unique agent type ID for a specific cell type and phase combination\n \"\"\"" ]
[ { "param": "cell_type", "type": "int" }, { "param": "cell_phase", "type": "int" }, { "param": "input_data", "type": "PhysicellData" }, { "param": "ids", "type": "Dict[int, Dict[int, int]]" }, { "param": "last_id", "type": "int" }, { "param": "type_mapp...
{ "returns": [], "raises": [], "params": [ { "identifier": "cell_type", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cell_phase", "type": "int", "docstring": null, "docstri...
9048232521115e8b440d8897940b2b8ffa7bdd94
allen-cell-animated/simularium-conversion
simulariumio/physicell/physicell_converter.py
[ "Apache-2.0" ]
Python
_get_trajectory_data
Tuple[AgentData, UnitData]
def _get_trajectory_data(input_data: PhysicellData) -> Tuple[AgentData, UnitData]: """ Get data from one time step in Simularium format """ ids = {} last_id = 0 type_mapping = {} physicell_data = PhysicellConverter._load_data( input_data.path_to_output...
Get data from one time step in Simularium format
Get data from one time step in Simularium format
[ "Get", "data", "from", "one", "time", "step", "in", "Simularium", "format" ]
def _get_trajectory_data(input_data: PhysicellData) -> Tuple[AgentData, UnitData]: ids = {} last_id = 0 type_mapping = {} physicell_data = PhysicellConverter._load_data( input_data.path_to_output_dir, input_data.nth_timestep_to_read ) total_steps = len(physice...
[ "def", "_get_trajectory_data", "(", "input_data", ":", "PhysicellData", ")", "->", "Tuple", "[", "AgentData", ",", "UnitData", "]", ":", "ids", "=", "{", "}", "last_id", "=", "0", "type_mapping", "=", "{", "}", "physicell_data", "=", "PhysicellConverter", "....
Get data from one time step in Simularium format
[ "Get", "data", "from", "one", "time", "step", "in", "Simularium", "format" ]
[ "\"\"\"\n Get data from one time step in Simularium format\n \"\"\"", "# get data dimensions", "# get data" ]
[ { "param": "input_data", "type": "PhysicellData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_data", "type": "PhysicellData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9048232521115e8b440d8897940b2b8ffa7bdd94
allen-cell-animated/simularium-conversion
simulariumio/physicell/physicell_converter.py
[ "Apache-2.0" ]
Python
_read
TrajectoryData
def _read(input_data: PhysicellData) -> TrajectoryData: """ Return a TrajectoryData object containing the PhysiCell data """ print("Reading PhysiCell Data -------------") agent_data, spatial_units, id_mapping = PhysicellConverter._get_trajectory_data( input_data ...
Return a TrajectoryData object containing the PhysiCell data
Return a TrajectoryData object containing the PhysiCell data
[ "Return", "a", "TrajectoryData", "object", "containing", "the", "PhysiCell", "data" ]
def _read(input_data: PhysicellData) -> TrajectoryData: print("Reading PhysiCell Data -------------") agent_data, spatial_units, id_mapping = PhysicellConverter._get_trajectory_data( input_data ) for cell_id in input_data.display_data: display_data = input_data.di...
[ "def", "_read", "(", "input_data", ":", "PhysicellData", ")", "->", "TrajectoryData", ":", "print", "(", "\"Reading PhysiCell Data -------------\"", ")", "agent_data", ",", "spatial_units", ",", "id_mapping", "=", "PhysicellConverter", ".", "_get_trajectory_data", "(", ...
Return a TrajectoryData object containing the PhysiCell data
[ "Return", "a", "TrajectoryData", "object", "containing", "the", "PhysiCell", "data" ]
[ "\"\"\"\n Return a TrajectoryData object containing the PhysiCell data\n \"\"\"", "# get display data (geometry and color)" ]
[ { "param": "input_data", "type": "PhysicellData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_data", "type": "PhysicellData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
65daf3cd2c80b36d98592be784c274da7f6630a4
allen-cell-animated/simularium-conversion
simulariumio/cellpack/cellpack_converter.py
[ "Apache-2.0" ]
Python
_parse_dimensions
DimensionData
def _parse_dimensions(all_ingredients, total_steps=1) -> DimensionData: """ Parse cellPack results file to get the total number of agents and the max curve length """ result = DimensionData(0, 0) for ingredient in all_ingredients: ingredient_results_data = ing...
Parse cellPack results file to get the total number of agents and the max curve length
Parse cellPack results file to get the total number of agents and the max curve length
[ "Parse", "cellPack", "results", "file", "to", "get", "the", "total", "number", "of", "agents", "and", "the", "max", "curve", "length" ]
def _parse_dimensions(all_ingredients, total_steps=1) -> DimensionData: result = DimensionData(0, 0) for ingredient in all_ingredients: ingredient_results_data = ingredient["results"] result.max_agents += len(ingredient_results_data["results"]) if "nbCurve" in ingredi...
[ "def", "_parse_dimensions", "(", "all_ingredients", ",", "total_steps", "=", "1", ")", "->", "DimensionData", ":", "result", "=", "DimensionData", "(", "0", ",", "0", ")", "for", "ingredient", "in", "all_ingredients", ":", "ingredient_results_data", "=", "ingred...
Parse cellPack results file to get the total number of agents and the max curve length
[ "Parse", "cellPack", "results", "file", "to", "get", "the", "total", "number", "of", "agents", "and", "the", "max", "curve", "length" ]
[ "\"\"\"\n Parse cellPack results file to get the total number of agents and\n the max curve length\n \"\"\"" ]
[ { "param": "all_ingredients", "type": null }, { "param": "total_steps", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "all_ingredients", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "total_steps", "type": null, "docstring": null, "do...
65daf3cd2c80b36d98592be784c274da7f6630a4
allen-cell-animated/simularium-conversion
simulariumio/cellpack/cellpack_converter.py
[ "Apache-2.0" ]
Python
_read
TrajectoryData
def _read(input_data: CellpackData) -> TrajectoryData: """ Return a TrajectoryData object containing the Cellpack data """ print("Reading Cellpack Data -------------") # currently only converts one model, ie one time step time_step_index = 0 # default scale for ce...
Return a TrajectoryData object containing the Cellpack data
Return a TrajectoryData object containing the Cellpack data
[ "Return", "a", "TrajectoryData", "object", "containing", "the", "Cellpack", "data" ]
def _read(input_data: CellpackData) -> TrajectoryData: print("Reading Cellpack Data -------------") time_step_index = 0 input_data.meta_data.scale_factor *= 0.1 recipe_loader = RecipeLoader(input_data.recipe_file_path) recipe_data = recipe_loader.recipe_data results_data ...
[ "def", "_read", "(", "input_data", ":", "CellpackData", ")", "->", "TrajectoryData", ":", "print", "(", "\"Reading Cellpack Data -------------\"", ")", "time_step_index", "=", "0", "input_data", ".", "meta_data", ".", "scale_factor", "*=", "0.1", "recipe_loader", "=...
Return a TrajectoryData object containing the Cellpack data
[ "Return", "a", "TrajectoryData", "object", "containing", "the", "Cellpack", "data" ]
[ "\"\"\"\n Return a TrajectoryData object containing the Cellpack data\n \"\"\"", "# currently only converts one model, ie one time step", "# default scale for cellpack => simularium", "# user is supposed to send in the cellPACK scale factor", "# if they send one in at all.", "# load the data...
[ { "param": "input_data", "type": "CellpackData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_data", "type": "CellpackData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
357af72544ae3fd8c1aebade11019b2c85089e76
allen-cell-animated/simularium-conversion
simulariumio/data_objects/unit_data.py
[ "Apache-2.0" ]
Python
_clamp_precision
<not_specific>
def _clamp_precision(self, number: float): """ clamp float precision to 4 significant figures """ return float("%.4g" % number)
clamp float precision to 4 significant figures
clamp float precision to 4 significant figures
[ "clamp", "float", "precision", "to", "4", "significant", "figures" ]
def _clamp_precision(self, number: float): return float("%.4g" % number)
[ "def", "_clamp_precision", "(", "self", ",", "number", ":", "float", ")", ":", "return", "float", "(", "\"%.4g\"", "%", "number", ")" ]
clamp float precision to 4 significant figures
[ "clamp", "float", "precision", "to", "4", "significant", "figures" ]
[ "\"\"\"\n clamp float precision to 4 significant figures\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "number", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "number", "type": "float", "docstring": null, "docstring_token...
357af72544ae3fd8c1aebade11019b2c85089e76
allen-cell-animated/simularium-conversion
simulariumio/data_objects/unit_data.py
[ "Apache-2.0" ]
Python
_update_units
null
def _update_units(self): """ update magnitude and name after setting quantity """ self._quantity = self._quantity.to_compact() self.magnitude = self._clamp_precision(self._quantity.magnitude) n = f"{self._quantity.units:~}" # pint has the wrong abbreviation for mi...
update magnitude and name after setting quantity
update magnitude and name after setting quantity
[ "update", "magnitude", "and", "name", "after", "setting", "quantity" ]
def _update_units(self): self._quantity = self._quantity.to_compact() self.magnitude = self._clamp_precision(self._quantity.magnitude) n = f"{self._quantity.units:~}" if n == "µ": n += "m" self.name = n
[ "def", "_update_units", "(", "self", ")", ":", "self", ".", "_quantity", "=", "self", ".", "_quantity", ".", "to_compact", "(", ")", "self", ".", "magnitude", "=", "self", ".", "_clamp_precision", "(", "self", ".", "_quantity", ".", "magnitude", ")", "n"...
update magnitude and name after setting quantity
[ "update", "magnitude", "and", "name", "after", "setting", "quantity" ]
[ "\"\"\"\n update magnitude and name after setting quantity\n \"\"\"", "# pint has the wrong abbreviation for microns? (µ instead of µm)" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f4db0576df1d99b3209235e203c3819b10718f42
allen-cell-animated/simularium-conversion
simulariumio/data_objects/meta_data.py
[ "Apache-2.0" ]
Python
from_buffer_data
<not_specific>
def from_buffer_data(cls, buffer_data: Dict[str, Any]): """ Create MetaData from a simularium JSON dict containing buffers """ return cls( box_size=np.array( [ float(buffer_data["trajectoryInfo"]["size"]["x"]), float(buf...
Create MetaData from a simularium JSON dict containing buffers
Create MetaData from a simularium JSON dict containing buffers
[ "Create", "MetaData", "from", "a", "simularium", "JSON", "dict", "containing", "buffers" ]
def from_buffer_data(cls, buffer_data: Dict[str, Any]): return cls( box_size=np.array( [ float(buffer_data["trajectoryInfo"]["size"]["x"]), float(buffer_data["trajectoryInfo"]["size"]["y"]), float(buffer_data["trajectoryInfo...
[ "def", "from_buffer_data", "(", "cls", ",", "buffer_data", ":", "Dict", "[", "str", ",", "Any", "]", ")", ":", "return", "cls", "(", "box_size", "=", "np", ".", "array", "(", "[", "float", "(", "buffer_data", "[", "\"trajectoryInfo\"", "]", "[", "\"siz...
Create MetaData from a simularium JSON dict containing buffers
[ "Create", "MetaData", "from", "a", "simularium", "JSON", "dict", "containing", "buffers" ]
[ "\"\"\"\n Create MetaData from a simularium JSON dict containing buffers\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "buffer_data", "type": "Dict[str, Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "buffer_data", "type": "Dict[str, Any]", "docstring": null, "do...
f4db0576df1d99b3209235e203c3819b10718f42
allen-cell-animated/simularium-conversion
simulariumio/data_objects/meta_data.py
[ "Apache-2.0" ]
Python
_set_box_size
null
def _set_box_size(self, box_size: np.ndarray = None): """ Set the box_size to the optional provided override value, or to the default value if it is currently None. If it's not set to the default value, multiply it by the scale_factor """ if self.box_size is None: ...
Set the box_size to the optional provided override value, or to the default value if it is currently None. If it's not set to the default value, multiply it by the scale_factor
Set the box_size to the optional provided override value, or to the default value if it is currently None. If it's not set to the default value, multiply it by the scale_factor
[ "Set", "the", "box_size", "to", "the", "optional", "provided", "override", "value", "or", "to", "the", "default", "value", "if", "it", "is", "currently", "None", ".", "If", "it", "'", "s", "not", "set", "to", "the", "default", "value", "multiply", "it", ...
def _set_box_size(self, box_size: np.ndarray = None): if self.box_size is None: if box_size is not None: self.box_size = box_size * self.scale_factor else: self.box_size = DEFAULT_BOX_SIZE else: self.box_size *= self.scale_factor
[ "def", "_set_box_size", "(", "self", ",", "box_size", ":", "np", ".", "ndarray", "=", "None", ")", ":", "if", "self", ".", "box_size", "is", "None", ":", "if", "box_size", "is", "not", "None", ":", "self", ".", "box_size", "=", "box_size", "*", "self...
Set the box_size to the optional provided override value, or to the default value if it is currently None.
[ "Set", "the", "box_size", "to", "the", "optional", "provided", "override", "value", "or", "to", "the", "default", "value", "if", "it", "is", "currently", "None", "." ]
[ "\"\"\"\n Set the box_size to the optional provided override value,\n or to the default value if it is currently None.\n If it's not set to the default value, multiply it by the scale_factor\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "box_size", "type": "np.ndarray" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "box_size", "type": "np.ndarray", "docstring": null, "docstrin...
22e0b09fad3019887b773a74c86d8632f9fb0c1f
allen-cell-animated/simularium-conversion
simulariumio/file_converter.py
[ "Apache-2.0" ]
Python
_update_trajectory_info_v1_to_v2
Dict[str, Any]
def _update_trajectory_info_v1_to_v2(data: Dict[str, Any]) -> Dict[str, Any]: """ Update the trajectory info block from v1 to v2 """ # units if "spatialUnitFactorMeters" in data["trajectoryInfo"]: spatial_units = UnitData( "m", data["trajectoryInfo"]["...
Update the trajectory info block from v1 to v2
Update the trajectory info block from v1 to v2
[ "Update", "the", "trajectory", "info", "block", "from", "v1", "to", "v2" ]
def _update_trajectory_info_v1_to_v2(data: Dict[str, Any]) -> Dict[str, Any]: if "spatialUnitFactorMeters" in data["trajectoryInfo"]: spatial_units = UnitData( "m", data["trajectoryInfo"]["spatialUnitFactorMeters"] ) data["trajectoryInfo"].pop("spatialUnitFact...
[ "def", "_update_trajectory_info_v1_to_v2", "(", "data", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "if", "\"spatialUnitFactorMeters\"", "in", "data", "[", "\"trajectoryInfo\"", "]", ":", "spatial_units", "=...
Update the trajectory info block from v1 to v2
[ "Update", "the", "trajectory", "info", "block", "from", "v1", "to", "v2" ]
[ "\"\"\"\n Update the trajectory info block from v1 to v2\n \"\"\"", "# units" ]
[ { "param": "data", "type": "Dict[str, Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data", "type": "Dict[str, Any]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
22e0b09fad3019887b773a74c86d8632f9fb0c1f
allen-cell-animated/simularium-conversion
simulariumio/file_converter.py
[ "Apache-2.0" ]
Python
_update_trajectory_info_v2_to_v3
Dict[str, Any]
def _update_trajectory_info_v2_to_v3(data: Dict[str, Any]) -> Dict[str, Any]: """ Update the trajectory info block from v2 to v3 """ # all the new fields from v2 to v3 are optional data["trajectoryInfo"]["version"] = 3 return data
Update the trajectory info block from v2 to v3
Update the trajectory info block from v2 to v3
[ "Update", "the", "trajectory", "info", "block", "from", "v2", "to", "v3" ]
def _update_trajectory_info_v2_to_v3(data: Dict[str, Any]) -> Dict[str, Any]: data["trajectoryInfo"]["version"] = 3 return data
[ "def", "_update_trajectory_info_v2_to_v3", "(", "data", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "data", "[", "\"trajectoryInfo\"", "]", "[", "\"version\"", "]", "=", "3", "return", "data" ]
Update the trajectory info block from v2 to v3
[ "Update", "the", "trajectory", "info", "block", "from", "v2", "to", "v3" ]
[ "\"\"\"\n Update the trajectory info block from v2 to v3\n \"\"\"", "# all the new fields from v2 to v3 are optional" ]
[ { "param": "data", "type": "Dict[str, Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data", "type": "Dict[str, Any]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
22e0b09fad3019887b773a74c86d8632f9fb0c1f
allen-cell-animated/simularium-conversion
simulariumio/file_converter.py
[ "Apache-2.0" ]
Python
update_trajectory_info_version
Dict[str, Any]
def update_trajectory_info_version(data: Dict[str, Any]) -> Dict[str, Any]: """ Update the trajectory info block to match the current version Parameters ---------- data: Dict[str, Any] A .simularium JSON file loaded in memory as a Dict. This objec...
Update the trajectory info block to match the current version Parameters ---------- data: Dict[str, Any] A .simularium JSON file loaded in memory as a Dict. This object will be mutated, not copied.
Update the trajectory info block to match the current version Parameters Dict[str, Any] A .simularium JSON file loaded in memory as a Dict. This object will be mutated, not copied.
[ "Update", "the", "trajectory", "info", "block", "to", "match", "the", "current", "version", "Parameters", "Dict", "[", "str", "Any", "]", "A", ".", "simularium", "JSON", "file", "loaded", "in", "memory", "as", "a", "Dict", ".", "This", "object", "will", ...
def update_trajectory_info_version(data: Dict[str, Any]) -> Dict[str, Any]: original_version = int(data["trajectoryInfo"]["version"]) if original_version == 1: data = FileConverter._update_trajectory_info_v1_to_v2(data) data = FileConverter._update_trajectory_info_v2_to_v3(data) ...
[ "def", "update_trajectory_info_version", "(", "data", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "original_version", "=", "int", "(", "data", "[", "\"trajectoryInfo\"", "]", "[", "\"version\"", "]", ")"...
Update the trajectory info block to match the current version
[ "Update", "the", "trajectory", "info", "block", "to", "match", "the", "current", "version" ]
[ "\"\"\"\n Update the trajectory info block\n to match the current version\n\n Parameters\n ----------\n data: Dict[str, Any]\n A .simularium JSON file loaded in memory as a Dict.\n This object will be mutated, not copied.\n \"\"\"" ]
[ { "param": "data", "type": "Dict[str, Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data", "type": "Dict[str, Any]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a964356abaad0b01e600d1d1b85f3357dc274a93
allen-cell-animated/simularium-conversion
simulariumio/mcell/mcell_converter.py
[ "Apache-2.0" ]
Python
_rotate
np.ndarray
def _rotate(v: np.ndarray, axis: np.ndarray, angle: float) -> np.ndarray: """ rotate a vector around axis by angle (radians) """ rotation = linalg.expm( np.cross(np.eye(3), McellConverter._normalize(axis) * angle) ) return np.dot(rotation, np.copy(v))
rotate a vector around axis by angle (radians)
rotate a vector around axis by angle (radians)
[ "rotate", "a", "vector", "around", "axis", "by", "angle", "(", "radians", ")" ]
def _rotate(v: np.ndarray, axis: np.ndarray, angle: float) -> np.ndarray: rotation = linalg.expm( np.cross(np.eye(3), McellConverter._normalize(axis) * angle) ) return np.dot(rotation, np.copy(v))
[ "def", "_rotate", "(", "v", ":", "np", ".", "ndarray", ",", "axis", ":", "np", ".", "ndarray", ",", "angle", ":", "float", ")", "->", "np", ".", "ndarray", ":", "rotation", "=", "linalg", ".", "expm", "(", "np", ".", "cross", "(", "np", ".", "e...
rotate a vector around axis by angle (radians)
[ "rotate", "a", "vector", "around", "axis", "by", "angle", "(", "radians", ")" ]
[ "\"\"\"\n rotate a vector around axis by angle (radians)\n \"\"\"" ]
[ { "param": "v", "type": "np.ndarray" }, { "param": "axis", "type": "np.ndarray" }, { "param": "angle", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "v", "type": "np.ndarray", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "axis", "type": "np.ndarray", "docstring": null, "docstri...
a964356abaad0b01e600d1d1b85f3357dc274a93
allen-cell-animated/simularium-conversion
simulariumio/mcell/mcell_converter.py
[ "Apache-2.0" ]
Python
_get_perpendicular_vector
np.ndarray
def _get_perpendicular_vector(v: np.ndarray, angle: float) -> np.ndarray: """ Get a unit vector perpendicular to the given vector rotated by the given angle """ if v[0] == 0 and v[1] == 0: if v[2] == 0: raise ValueError("Cannot calculate perpendicular ...
Get a unit vector perpendicular to the given vector rotated by the given angle
Get a unit vector perpendicular to the given vector rotated by the given angle
[ "Get", "a", "unit", "vector", "perpendicular", "to", "the", "given", "vector", "rotated", "by", "the", "given", "angle" ]
def _get_perpendicular_vector(v: np.ndarray, angle: float) -> np.ndarray: if v[0] == 0 and v[1] == 0: if v[2] == 0: raise ValueError("Cannot calculate perpendicular vector to zero vector") return np.array([0, 1, 0]) u = McellConverter._normalize(np.array([-v[1], v...
[ "def", "_get_perpendicular_vector", "(", "v", ":", "np", ".", "ndarray", ",", "angle", ":", "float", ")", "->", "np", ".", "ndarray", ":", "if", "v", "[", "0", "]", "==", "0", "and", "v", "[", "1", "]", "==", "0", ":", "if", "v", "[", "2", "]...
Get a unit vector perpendicular to the given vector rotated by the given angle
[ "Get", "a", "unit", "vector", "perpendicular", "to", "the", "given", "vector", "rotated", "by", "the", "given", "angle" ]
[ "\"\"\"\n Get a unit vector perpendicular to the given vector\n rotated by the given angle\n \"\"\"" ]
[ { "param": "v", "type": "np.ndarray" }, { "param": "angle", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "v", "type": "np.ndarray", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "angle", "type": "float", "docstring": null, "docstring_t...
a964356abaad0b01e600d1d1b85f3357dc274a93
allen-cell-animated/simularium-conversion
simulariumio/mcell/mcell_converter.py
[ "Apache-2.0" ]
Python
_get_rotation_matrix
np.ndarray
def _get_rotation_matrix(v1: np.ndarray, v2: np.ndarray) -> np.ndarray: """ Orthonormalize and cross the vectors to get a rotation matrix """ v1 = McellConverter._normalize(v1) v2 = McellConverter._normalize(v2) v2 = McellConverter._normalize(v2 - (np.dot(v1, v2) / np.dot...
Orthonormalize and cross the vectors to get a rotation matrix
Orthonormalize and cross the vectors to get a rotation matrix
[ "Orthonormalize", "and", "cross", "the", "vectors", "to", "get", "a", "rotation", "matrix" ]
def _get_rotation_matrix(v1: np.ndarray, v2: np.ndarray) -> np.ndarray: v1 = McellConverter._normalize(v1) v2 = McellConverter._normalize(v2) v2 = McellConverter._normalize(v2 - (np.dot(v1, v2) / np.dot(v1, v1)) * v1) v3 = np.cross(v2, v1) return np.array( [ ...
[ "def", "_get_rotation_matrix", "(", "v1", ":", "np", ".", "ndarray", ",", "v2", ":", "np", ".", "ndarray", ")", "->", "np", ".", "ndarray", ":", "v1", "=", "McellConverter", ".", "_normalize", "(", "v1", ")", "v2", "=", "McellConverter", ".", "_normali...
Orthonormalize and cross the vectors to get a rotation matrix
[ "Orthonormalize", "and", "cross", "the", "vectors", "to", "get", "a", "rotation", "matrix" ]
[ "\"\"\"\n Orthonormalize and cross the vectors to get a rotation matrix\n \"\"\"" ]
[ { "param": "v1", "type": "np.ndarray" }, { "param": "v2", "type": "np.ndarray" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "v1", "type": "np.ndarray", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v2", "type": "np.ndarray", "docstring": null, "docstrin...
a964356abaad0b01e600d1d1b85f3357dc274a93
allen-cell-animated/simularium-conversion
simulariumio/mcell/mcell_converter.py
[ "Apache-2.0" ]
Python
_get_euler_angles
np.ndarray
def _get_euler_angles(normal: np.ndarray, angle: float) -> np.ndarray: """ Get euler angles in degrees representing a rotation defined by the basis between the given normal and a perpendicular vector rotated at angle """ perpendicular = McellConverter._get_perpendicular_vector(no...
Get euler angles in degrees representing a rotation defined by the basis between the given normal and a perpendicular vector rotated at angle
Get euler angles in degrees representing a rotation defined by the basis between the given normal and a perpendicular vector rotated at angle
[ "Get", "euler", "angles", "in", "degrees", "representing", "a", "rotation", "defined", "by", "the", "basis", "between", "the", "given", "normal", "and", "a", "perpendicular", "vector", "rotated", "at", "angle" ]
def _get_euler_angles(normal: np.ndarray, angle: float) -> np.ndarray: perpendicular = McellConverter._get_perpendicular_vector(normal, angle) rotation = McellConverter._get_rotation_matrix(normal, perpendicular) return Rotation.from_matrix(rotation).as_euler("xyz", degrees=True)
[ "def", "_get_euler_angles", "(", "normal", ":", "np", ".", "ndarray", ",", "angle", ":", "float", ")", "->", "np", ".", "ndarray", ":", "perpendicular", "=", "McellConverter", ".", "_get_perpendicular_vector", "(", "normal", ",", "angle", ")", "rotation", "=...
Get euler angles in degrees representing a rotation defined by the basis between the given normal and a perpendicular vector rotated at angle
[ "Get", "euler", "angles", "in", "degrees", "representing", "a", "rotation", "defined", "by", "the", "basis", "between", "the", "given", "normal", "and", "a", "perpendicular", "vector", "rotated", "at", "angle" ]
[ "\"\"\"\n Get euler angles in degrees representing a rotation defined by the basis\n between the given normal and a perpendicular vector rotated at angle\n \"\"\"" ]
[ { "param": "normal", "type": "np.ndarray" }, { "param": "angle", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "normal", "type": "np.ndarray", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "angle", "type": "float", "docstring": null, "docstr...
a964356abaad0b01e600d1d1b85f3357dc274a93
allen-cell-animated/simularium-conversion
simulariumio/mcell/mcell_converter.py
[ "Apache-2.0" ]
Python
_get_rotation_euler_angles_for_normals
np.ndarray
def _get_rotation_euler_angles_for_normals( normals: np.ndarray, angle: float = None ) -> np.ndarray: """ Generate an orientation around each normal and return euler angles Either use the given angle or random ones """ if angle is None: angles = np.rad2deg...
Generate an orientation around each normal and return euler angles Either use the given angle or random ones
Generate an orientation around each normal and return euler angles Either use the given angle or random ones
[ "Generate", "an", "orientation", "around", "each", "normal", "and", "return", "euler", "angles", "Either", "use", "the", "given", "angle", "or", "random", "ones" ]
def _get_rotation_euler_angles_for_normals( normals: np.ndarray, angle: float = None ) -> np.ndarray: if angle is None: angles = np.rad2deg(2 * np.pi) * np.random.random(normals.shape[0]) else: angles = np.array(normals.shape[0] * [angle]) return np.array( ...
[ "def", "_get_rotation_euler_angles_for_normals", "(", "normals", ":", "np", ".", "ndarray", ",", "angle", ":", "float", "=", "None", ")", "->", "np", ".", "ndarray", ":", "if", "angle", "is", "None", ":", "angles", "=", "np", ".", "rad2deg", "(", "2", ...
Generate an orientation around each normal and return euler angles Either use the given angle or random ones
[ "Generate", "an", "orientation", "around", "each", "normal", "and", "return", "euler", "angles", "Either", "use", "the", "given", "angle", "or", "random", "ones" ]
[ "\"\"\"\n Generate an orientation around each normal and return euler angles\n Either use the given angle or random ones\n \"\"\"" ]
[ { "param": "normals", "type": "np.ndarray" }, { "param": "angle", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "normals", "type": "np.ndarray", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "angle", "type": "float", "docstring": null, "docst...
a964356abaad0b01e600d1d1b85f3357dc274a93
allen-cell-animated/simularium-conversion
simulariumio/mcell/mcell_converter.py
[ "Apache-2.0" ]
Python
_count_agents_in_binary_cellblender_viz_frame
int
def _count_agents_in_binary_cellblender_viz_frame(file_name: str) -> int: """ Count the number of agents in the frame of cellblender data """ total_mols = 0 with open(file_name, "rb") as mol_file: # first 4 bytes must contain value '1' b = array.array("I")...
Count the number of agents in the frame of cellblender data
Count the number of agents in the frame of cellblender data
[ "Count", "the", "number", "of", "agents", "in", "the", "frame", "of", "cellblender", "data" ]
def _count_agents_in_binary_cellblender_viz_frame(file_name: str) -> int: total_mols = 0 with open(file_name, "rb") as mol_file: b = array.array("I") b.fromfile(mol_file, 1) assert b[0] == 1 while True: try: n_chars_type...
[ "def", "_count_agents_in_binary_cellblender_viz_frame", "(", "file_name", ":", "str", ")", "->", "int", ":", "total_mols", "=", "0", "with", "open", "(", "file_name", ",", "\"rb\"", ")", "as", "mol_file", ":", "b", "=", "array", ".", "array", "(", "\"I\"", ...
Count the number of agents in the frame of cellblender data
[ "Count", "the", "number", "of", "agents", "in", "the", "frame", "of", "cellblender", "data" ]
[ "\"\"\"\n Count the number of agents in the frame of cellblender data\n \"\"\"", "# first 4 bytes must contain value '1'", "# advance through file to get", "# number of instances of each molecule type" ]
[ { "param": "file_name", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "file_name", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a964356abaad0b01e600d1d1b85f3357dc274a93
allen-cell-animated/simularium-conversion
simulariumio/mcell/mcell_converter.py
[ "Apache-2.0" ]
Python
_get_dimensions_of_cellblender_data
DimensionData
def _get_dimensions_of_cellblender_data( path_to_binary_files: str, nth_timestep_to_read: int ) -> DimensionData: """ Parse cellblender binary files to get the number of timesteps and maximum agents per timestep """ result = DimensionData(0, 0) for file_name i...
Parse cellblender binary files to get the number of timesteps and maximum agents per timestep
Parse cellblender binary files to get the number of timesteps and maximum agents per timestep
[ "Parse", "cellblender", "binary", "files", "to", "get", "the", "number", "of", "timesteps", "and", "maximum", "agents", "per", "timestep" ]
def _get_dimensions_of_cellblender_data( path_to_binary_files: str, nth_timestep_to_read: int ) -> DimensionData: result = DimensionData(0, 0) for file_name in os.listdir(path_to_binary_files): if not McellConverter._should_read_cellblender_binary_file( file_name,...
[ "def", "_get_dimensions_of_cellblender_data", "(", "path_to_binary_files", ":", "str", ",", "nth_timestep_to_read", ":", "int", ")", "->", "DimensionData", ":", "result", "=", "DimensionData", "(", "0", ",", "0", ")", "for", "file_name", "in", "os", ".", "listdi...
Parse cellblender binary files to get the number of timesteps and maximum agents per timestep
[ "Parse", "cellblender", "binary", "files", "to", "get", "the", "number", "of", "timesteps", "and", "maximum", "agents", "per", "timestep" ]
[ "\"\"\"\n Parse cellblender binary files to get the number of timesteps\n and maximum agents per timestep\n \"\"\"" ]
[ { "param": "path_to_binary_files", "type": "str" }, { "param": "nth_timestep_to_read", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path_to_binary_files", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "nth_timestep_to_read", "type": "int", "docstring":...
a964356abaad0b01e600d1d1b85f3357dc274a93
allen-cell-animated/simularium-conversion
simulariumio/mcell/mcell_converter.py
[ "Apache-2.0" ]
Python
_read_binary_cellblender_viz_frame
AgentData
def _read_binary_cellblender_viz_frame( file_name: str, time_index: int, molecule_info: Dict[str, Dict[str, Any]], input_data: McellData, result: AgentData, ) -> AgentData: """ Read MCell binary visualization files code based on cellblender/cellblende...
Read MCell binary visualization files code based on cellblender/cellblender_mol_viz.py function mol_viz_file_read
Read MCell binary visualization files code based on cellblender/cellblender_mol_viz.py function mol_viz_file_read
[ "Read", "MCell", "binary", "visualization", "files", "code", "based", "on", "cellblender", "/", "cellblender_mol_viz", ".", "py", "function", "mol_viz_file_read" ]
def _read_binary_cellblender_viz_frame( file_name: str, time_index: int, molecule_info: Dict[str, Dict[str, Any]], input_data: McellData, result: AgentData, ) -> AgentData: with open(file_name, "rb") as mol_file: b = array.array("I") b.fromfile...
[ "def", "_read_binary_cellblender_viz_frame", "(", "file_name", ":", "str", ",", "time_index", ":", "int", ",", "molecule_info", ":", "Dict", "[", "str", ",", "Dict", "[", "str", ",", "Any", "]", "]", ",", "input_data", ":", "McellData", ",", "result", ":",...
Read MCell binary visualization files code based on cellblender/cellblender_mol_viz.py function mol_viz_file_read
[ "Read", "MCell", "binary", "visualization", "files", "code", "based", "on", "cellblender", "/", "cellblender_mol_viz", ".", "py", "function", "mol_viz_file_read" ]
[ "\"\"\"\n Read MCell binary visualization files\n\n code based on cellblender/cellblender_mol_viz.py function mol_viz_file_read\n \"\"\"", "# first 4 bytes must contain value '1'", "# get type name", "# get positions and rotations", "# save to AgentData", "# MCell binary format has no...
[ { "param": "file_name", "type": "str" }, { "param": "time_index", "type": "int" }, { "param": "molecule_info", "type": "Dict[str, Dict[str, Any]]" }, { "param": "input_data", "type": "McellData" }, { "param": "result", "type": "AgentData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "file_name", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "time_index", "type": "int", "docstring": null, "docstri...
a964356abaad0b01e600d1d1b85f3357dc274a93
allen-cell-animated/simularium-conversion
simulariumio/mcell/mcell_converter.py
[ "Apache-2.0" ]
Python
_read_cellblender_data
AgentData
def _read_cellblender_data( timestep: float, molecule_list: Dict[str, Any], input_data: McellData, ) -> AgentData: """ Parse cellblender binary files to get spatial data """ dimensions = McellConverter._get_dimensions_of_cellblender_data( input_dat...
Parse cellblender binary files to get spatial data
Parse cellblender binary files to get spatial data
[ "Parse", "cellblender", "binary", "files", "to", "get", "spatial", "data" ]
def _read_cellblender_data( timestep: float, molecule_list: Dict[str, Any], input_data: McellData, ) -> AgentData: dimensions = McellConverter._get_dimensions_of_cellblender_data( input_data.path_to_binary_files, input_data.nth_timestep_to_read ) result = ...
[ "def", "_read_cellblender_data", "(", "timestep", ":", "float", ",", "molecule_list", ":", "Dict", "[", "str", ",", "Any", "]", ",", "input_data", ":", "McellData", ",", ")", "->", "AgentData", ":", "dimensions", "=", "McellConverter", ".", "_get_dimensions_of...
Parse cellblender binary files to get spatial data
[ "Parse", "cellblender", "binary", "files", "to", "get", "spatial", "data" ]
[ "\"\"\"\n Parse cellblender binary files to get spatial data\n \"\"\"", "# get metadata for each agent type" ]
[ { "param": "timestep", "type": "float" }, { "param": "molecule_list", "type": "Dict[str, Any]" }, { "param": "input_data", "type": "McellData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timestep", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "molecule_list", "type": "Dict[str, Any]", "docstring": null,...
a964356abaad0b01e600d1d1b85f3357dc274a93
allen-cell-animated/simularium-conversion
simulariumio/mcell/mcell_converter.py
[ "Apache-2.0" ]
Python
_read
TrajectoryData
def _read(input_data: McellData) -> TrajectoryData: """ Return an object containing the data shaped for Simularium format """ print("Reading MCell Data -------------") # read data model json with open(input_data.path_to_data_model_json) as data_model_file: dat...
Return an object containing the data shaped for Simularium format
Return an object containing the data shaped for Simularium format
[ "Return", "an", "object", "containing", "the", "data", "shaped", "for", "Simularium", "format" ]
def _read(input_data: McellData) -> TrajectoryData: print("Reading MCell Data -------------") with open(input_data.path_to_data_model_json) as data_model_file: data_model = json.load(data_model_file) time_units = UnitData( "s", float(data_model["mcell"]["initialization"][...
[ "def", "_read", "(", "input_data", ":", "McellData", ")", "->", "TrajectoryData", ":", "print", "(", "\"Reading MCell Data -------------\"", ")", "with", "open", "(", "input_data", ".", "path_to_data_model_json", ")", "as", "data_model_file", ":", "data_model", "=",...
Return an object containing the data shaped for Simularium format
[ "Return", "an", "object", "containing", "the", "data", "shaped", "for", "Simularium", "format" ]
[ "\"\"\"\n Return an object containing the data shaped for Simularium format\n \"\"\"", "# read data model json", "# read spatial data", "# get box size", "# get display data (geometry and color)" ]
[ { "param": "input_data", "type": "McellData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_data", "type": "McellData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a6b1737aab59ccb1908efc033ab4cfb0565a647e
allen-cell-animated/simularium-conversion
simulariumio/cytosim/cytosim_converter.py
[ "Apache-2.0" ]
Python
_ignore_line
bool
def _ignore_line(line: str) -> bool: """ if the line doesn't have any data, it can be ignored """ return len(line) < 1 or line[0:7] == "warning" or "report" in line
if the line doesn't have any data, it can be ignored
if the line doesn't have any data, it can be ignored
[ "if", "the", "line", "doesn", "'", "t", "have", "any", "data", "it", "can", "be", "ignored" ]
def _ignore_line(line: str) -> bool: return len(line) < 1 or line[0:7] == "warning" or "report" in line
[ "def", "_ignore_line", "(", "line", ":", "str", ")", "->", "bool", ":", "return", "len", "(", "line", ")", "<", "1", "or", "line", "[", "0", ":", "7", "]", "==", "\"warning\"", "or", "\"report\"", "in", "line" ]
if the line doesn't have any data, it can be ignored
[ "if", "the", "line", "doesn", "'", "t", "have", "any", "data", "it", "can", "be", "ignored" ]
[ "\"\"\"\n if the line doesn't have any data, it can be ignored\n \"\"\"" ]
[ { "param": "line", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "line", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a6b1737aab59ccb1908efc033ab4cfb0565a647e
allen-cell-animated/simularium-conversion
simulariumio/cytosim/cytosim_converter.py
[ "Apache-2.0" ]
Python
_parse_object_dimensions
DimensionData
def _parse_object_dimensions( data_lines: List[str], is_fiber: bool, ) -> DimensionData: """ Parse a Cytosim output file containing objects (fibers, solids, singles, or couples) to get the number of subpoints per agent per timestep """ result = Dimensi...
Parse a Cytosim output file containing objects (fibers, solids, singles, or couples) to get the number of subpoints per agent per timestep
Parse a Cytosim output file containing objects (fibers, solids, singles, or couples) to get the number of subpoints per agent per timestep
[ "Parse", "a", "Cytosim", "output", "file", "containing", "objects", "(", "fibers", "solids", "singles", "or", "couples", ")", "to", "get", "the", "number", "of", "subpoints", "per", "agent", "per", "timestep" ]
def _parse_object_dimensions( data_lines: List[str], is_fiber: bool, ) -> DimensionData: result = DimensionData(0, 0) agents = 0 subpoints = 0 for line in data_lines: if CytosimConverter._ignore_line(line): continue if line[0] =...
[ "def", "_parse_object_dimensions", "(", "data_lines", ":", "List", "[", "str", "]", ",", "is_fiber", ":", "bool", ",", ")", "->", "DimensionData", ":", "result", "=", "DimensionData", "(", "0", ",", "0", ")", "agents", "=", "0", "subpoints", "=", "0", ...
Parse a Cytosim output file containing objects (fibers, solids, singles, or couples) to get the number of subpoints per agent per timestep
[ "Parse", "a", "Cytosim", "output", "file", "containing", "objects", "(", "fibers", "solids", "singles", "or", "couples", ")", "to", "get", "the", "number", "of", "subpoints", "per", "agent", "per", "timestep" ]
[ "\"\"\"\n Parse a Cytosim output file containing objects\n (fibers, solids, singles, or couples) to get the number\n of subpoints per agent per timestep\n \"\"\"" ]
[ { "param": "data_lines", "type": "List[str]" }, { "param": "is_fiber", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data_lines", "type": "List[str]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "is_fiber", "type": "bool", "docstring": null, "d...
a6b1737aab59ccb1908efc033ab4cfb0565a647e
allen-cell-animated/simularium-conversion
simulariumio/cytosim/cytosim_converter.py
[ "Apache-2.0" ]
Python
_parse_dimensions
DimensionData
def _parse_dimensions(cytosim_data: Dict[str, List[str]]) -> DimensionData: """ Parse Cytosim output files to get the total steps, maximum agents per timestep, and maximum subpoints per agent """ result = DimensionData(0, 0) for object_type in cytosim_data: ob...
Parse Cytosim output files to get the total steps, maximum agents per timestep, and maximum subpoints per agent
Parse Cytosim output files to get the total steps, maximum agents per timestep, and maximum subpoints per agent
[ "Parse", "Cytosim", "output", "files", "to", "get", "the", "total", "steps", "maximum", "agents", "per", "timestep", "and", "maximum", "subpoints", "per", "agent" ]
def _parse_dimensions(cytosim_data: Dict[str, List[str]]) -> DimensionData: result = DimensionData(0, 0) for object_type in cytosim_data: object_dimensions = CytosimConverter._parse_object_dimensions( cytosim_data[object_type], "fiber" in object_type, ...
[ "def", "_parse_dimensions", "(", "cytosim_data", ":", "Dict", "[", "str", ",", "List", "[", "str", "]", "]", ")", "->", "DimensionData", ":", "result", "=", "DimensionData", "(", "0", ",", "0", ")", "for", "object_type", "in", "cytosim_data", ":", "objec...
Parse Cytosim output files to get the total steps, maximum agents per timestep, and maximum subpoints per agent
[ "Parse", "Cytosim", "output", "files", "to", "get", "the", "total", "steps", "maximum", "agents", "per", "timestep", "and", "maximum", "subpoints", "per", "agent" ]
[ "\"\"\"\n Parse Cytosim output files to get the total steps,\n maximum agents per timestep, and maximum subpoints per agent\n \"\"\"" ]
[ { "param": "cytosim_data", "type": "Dict[str, List[str]]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cytosim_data", "type": "Dict[str, List[str]]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a6b1737aab59ccb1908efc033ab4cfb0565a647e
allen-cell-animated/simularium-conversion
simulariumio/cytosim/cytosim_converter.py
[ "Apache-2.0" ]
Python
_parse_objects
Tuple[Dict[str, Any], List[int]]
def _parse_objects( object_type: str, data_lines: List[str], scale_factor: float, object_info: CytosimObjectInfo, result: AgentData, used_unique_IDs: List[int], ) -> Tuple[Dict[str, Any], List[int]]: """ Parse a Cytosim output file containing objects ...
Parse a Cytosim output file containing objects (fibers, solids, singles, or couples) to get agents
Parse a Cytosim output file containing objects (fibers, solids, singles, or couples) to get agents
[ "Parse", "a", "Cytosim", "output", "file", "containing", "objects", "(", "fibers", "solids", "singles", "or", "couples", ")", "to", "get", "agents" ]
def _parse_objects( object_type: str, data_lines: List[str], scale_factor: float, object_info: CytosimObjectInfo, result: AgentData, used_unique_IDs: List[int], ) -> Tuple[Dict[str, Any], List[int]]: time_index = -1 uids = {} is_fiber = "fiber"...
[ "def", "_parse_objects", "(", "object_type", ":", "str", ",", "data_lines", ":", "List", "[", "str", "]", ",", "scale_factor", ":", "float", ",", "object_info", ":", "CytosimObjectInfo", ",", "result", ":", "AgentData", ",", "used_unique_IDs", ":", "List", "...
Parse a Cytosim output file containing objects (fibers, solids, singles, or couples) to get agents
[ "Parse", "a", "Cytosim", "output", "file", "containing", "objects", "(", "fibers", "solids", "singles", "or", "couples", ")", "to", "get", "agents" ]
[ "\"\"\"\n Parse a Cytosim output file containing objects\n (fibers, solids, singles, or couples) to get agents\n \"\"\"", "# start of frame", "# time metadata", "# start of fiber object", "# each fiber point", "# position", "# each non-fiber object", "# position" ]
[ { "param": "object_type", "type": "str" }, { "param": "data_lines", "type": "List[str]" }, { "param": "scale_factor", "type": "float" }, { "param": "object_info", "type": "CytosimObjectInfo" }, { "param": "result", "type": "AgentData" }, { "param": "us...
{ "returns": [], "raises": [], "params": [ { "identifier": "object_type", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data_lines", "type": "List[str]", "docstring": null, ...
a6b1737aab59ccb1908efc033ab4cfb0565a647e
allen-cell-animated/simularium-conversion
simulariumio/cytosim/cytosim_converter.py
[ "Apache-2.0" ]
Python
_read
TrajectoryData
def _read(input_data: CytosimData) -> TrajectoryData: """ Return a TrajectoryData object containing the CytoSim data """ print("Reading Cytosim Data -------------") # load the data from Cytosim output .txt files cytosim_data = {} for object_type in input_data.obje...
Return a TrajectoryData object containing the CytoSim data
Return a TrajectoryData object containing the CytoSim data
[ "Return", "a", "TrajectoryData", "object", "containing", "the", "CytoSim", "data" ]
def _read(input_data: CytosimData) -> TrajectoryData: print("Reading Cytosim Data -------------") cytosim_data = {} for object_type in input_data.object_info: cytosim_data[object_type] = ( input_data.object_info[object_type] .cytosim_file.get_contents(...
[ "def", "_read", "(", "input_data", ":", "CytosimData", ")", "->", "TrajectoryData", ":", "print", "(", "\"Reading Cytosim Data -------------\"", ")", "cytosim_data", "=", "{", "}", "for", "object_type", "in", "input_data", ".", "object_info", ":", "cytosim_data", ...
Return a TrajectoryData object containing the CytoSim data
[ "Return", "a", "TrajectoryData", "object", "containing", "the", "CytoSim", "data" ]
[ "\"\"\"\n Return a TrajectoryData object containing the CytoSim data\n \"\"\"", "# load the data from Cytosim output .txt files", "# parse", "# get display data (geometry and color)", "# create TrajectoryData" ]
[ { "param": "input_data", "type": "CytosimData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_data", "type": "CytosimData", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3357fe11d9adb42ebfaa97075a0813077862771b
allen-cell-animated/simularium-conversion
simulariumio/filters/add_agents_filter.py
[ "Apache-2.0" ]
Python
apply
TrajectoryData
def apply(self, data: TrajectoryData) -> TrajectoryData: """ Add the given agents to each frame of the simularium data """ print("Filtering: add agents -------------") data.append_agents(self.new_agent_data) return data
Add the given agents to each frame of the simularium data
Add the given agents to each frame of the simularium data
[ "Add", "the", "given", "agents", "to", "each", "frame", "of", "the", "simularium", "data" ]
def apply(self, data: TrajectoryData) -> TrajectoryData: print("Filtering: add agents -------------") data.append_agents(self.new_agent_data) return data
[ "def", "apply", "(", "self", ",", "data", ":", "TrajectoryData", ")", "->", "TrajectoryData", ":", "print", "(", "\"Filtering: add agents -------------\"", ")", "data", ".", "append_agents", "(", "self", ".", "new_agent_data", ")", "return", "data" ]
Add the given agents to each frame of the simularium data
[ "Add", "the", "given", "agents", "to", "each", "frame", "of", "the", "simularium", "data" ]
[ "\"\"\"\n Add the given agents to each frame of the simularium data\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "data", "type": "TrajectoryData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "TrajectoryData", "docstring": null, "docstrin...
00b924ee8a07e5d1273103377e160a742b5e8919
shepherdpp/qteasy
qteasy/visual.py
[ "CC0-1.0" ]
Python
candle
<not_specific>
def candle(stock=None, start=None, end=None, stock_data=None, share_name=None, asset_type='E', no_visual=False, **kwargs): """plot stock data or extracted data in candle form""" return mpf_plot(stock_data=stock_data, share_name=share_name, stock=stock, start=start, end=end, asset_...
plot stock data or extracted data in candle form
plot stock data or extracted data in candle form
[ "plot", "stock", "data", "or", "extracted", "data", "in", "candle", "form" ]
def candle(stock=None, start=None, end=None, stock_data=None, share_name=None, asset_type='E', no_visual=False, **kwargs): return mpf_plot(stock_data=stock_data, share_name=share_name, stock=stock, start=start, end=end, asset_type=asset_type, plot_type='candle', no_visual=no_visual, ...
[ "def", "candle", "(", "stock", "=", "None", ",", "start", "=", "None", ",", "end", "=", "None", ",", "stock_data", "=", "None", ",", "share_name", "=", "None", ",", "asset_type", "=", "'E'", ",", "no_visual", "=", "False", ",", "**", "kwargs", ")", ...
plot stock data or extracted data in candle form
[ "plot", "stock", "data", "or", "extracted", "data", "in", "candle", "form" ]
[ "\"\"\"plot stock data or extracted data in candle form\"\"\"" ]
[ { "param": "stock", "type": null }, { "param": "start", "type": null }, { "param": "end", "type": null }, { "param": "stock_data", "type": null }, { "param": "share_name", "type": null }, { "param": "asset_type", "type": null }, { "param": ...
{ "returns": [], "raises": [], "params": [ { "identifier": "stock", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "start", "type": null, "docstring": null, "docstring_tokens":...
00b924ee8a07e5d1273103377e160a742b5e8919
shepherdpp/qteasy
qteasy/visual.py
[ "CC0-1.0" ]
Python
ohlc
<not_specific>
def ohlc(stock=None, start=None, end=None, stock_data=None, share_name=None, asset_type='E', no_visual=False, **kwargs): """plot stock data or extracted data in ohlc form""" return mpf_plot(stock_data=stock_data, share_name=share_name, stock=stock, start=start, end=end, asset_type=a...
plot stock data or extracted data in ohlc form
plot stock data or extracted data in ohlc form
[ "plot", "stock", "data", "or", "extracted", "data", "in", "ohlc", "form" ]
def ohlc(stock=None, start=None, end=None, stock_data=None, share_name=None, asset_type='E', no_visual=False, **kwargs): return mpf_plot(stock_data=stock_data, share_name=share_name, stock=stock, start=start, end=end, asset_type=asset_type, plot_type='ohlc', no_visual=no_visual, ...
[ "def", "ohlc", "(", "stock", "=", "None", ",", "start", "=", "None", ",", "end", "=", "None", ",", "stock_data", "=", "None", ",", "share_name", "=", "None", ",", "asset_type", "=", "'E'", ",", "no_visual", "=", "False", ",", "**", "kwargs", ")", "...
plot stock data or extracted data in ohlc form
[ "plot", "stock", "data", "or", "extracted", "data", "in", "ohlc", "form" ]
[ "\"\"\"plot stock data or extracted data in ohlc form\"\"\"" ]
[ { "param": "stock", "type": null }, { "param": "start", "type": null }, { "param": "end", "type": null }, { "param": "stock_data", "type": null }, { "param": "share_name", "type": null }, { "param": "asset_type", "type": null }, { "param": ...
{ "returns": [], "raises": [], "params": [ { "identifier": "stock", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "start", "type": null, "docstring": null, "docstring_tokens":...
00b924ee8a07e5d1273103377e160a742b5e8919
shepherdpp/qteasy
qteasy/visual.py
[ "CC0-1.0" ]
Python
renko
<not_specific>
def renko(stock=None, start=None, end=None, stock_data=None, share_name=None, asset_type='E', no_visual=False, **kwargs): """plot stock data or extracted data in renko form""" return mpf_plot(stock_data=stock_data, share_name=share_name, stock=stock, start=start, end=end, asset_typ...
plot stock data or extracted data in renko form
plot stock data or extracted data in renko form
[ "plot", "stock", "data", "or", "extracted", "data", "in", "renko", "form" ]
def renko(stock=None, start=None, end=None, stock_data=None, share_name=None, asset_type='E', no_visual=False, **kwargs): return mpf_plot(stock_data=stock_data, share_name=share_name, stock=stock, start=start, end=end, asset_type=asset_type, plot_type='renko', no_visual=no_visual, ...
[ "def", "renko", "(", "stock", "=", "None", ",", "start", "=", "None", ",", "end", "=", "None", ",", "stock_data", "=", "None", ",", "share_name", "=", "None", ",", "asset_type", "=", "'E'", ",", "no_visual", "=", "False", ",", "**", "kwargs", ")", ...
plot stock data or extracted data in renko form
[ "plot", "stock", "data", "or", "extracted", "data", "in", "renko", "form" ]
[ "\"\"\"plot stock data or extracted data in renko form\"\"\"" ]
[ { "param": "stock", "type": null }, { "param": "start", "type": null }, { "param": "end", "type": null }, { "param": "stock_data", "type": null }, { "param": "share_name", "type": null }, { "param": "asset_type", "type": null }, { "param": ...
{ "returns": [], "raises": [], "params": [ { "identifier": "stock", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "start", "type": null, "docstring": null, "docstring_tokens":...
00b924ee8a07e5d1273103377e160a742b5e8919
shepherdpp/qteasy
qteasy/visual.py
[ "CC0-1.0" ]
Python
mpf_plot
<not_specific>
def mpf_plot(stock_data=None, share_name=None, stock=None, start=None, end=None, asset_type='E', plot_type=None, no_visual=False, mav=None, indicator=None, indicator_par=None, **kwargs): """plot stock data or extracted data in renko form """ assert plot_type is not None if end ...
plot stock data or extracted data in renko form
plot stock data or extracted data in renko form
[ "plot", "stock", "data", "or", "extracted", "data", "in", "renko", "form" ]
def mpf_plot(stock_data=None, share_name=None, stock=None, start=None, end=None, asset_type='E', plot_type=None, no_visual=False, mav=None, indicator=None, indicator_par=None, **kwargs): assert plot_type is not None if end is None: now = pd.to_datetime('now') + pd.Timedelta(8, ...
[ "def", "mpf_plot", "(", "stock_data", "=", "None", ",", "share_name", "=", "None", ",", "stock", "=", "None", ",", "start", "=", "None", ",", "end", "=", "None", ",", "asset_type", "=", "'E'", ",", "plot_type", "=", "None", ",", "no_visual", "=", "Fa...
plot stock data or extracted data in renko form
[ "plot", "stock", "data", "or", "extracted", "data", "in", "renko", "form" ]
[ "\"\"\"plot stock data or extracted data in renko form\n \"\"\"", "# 当stock_data没有给出时,则从网上或本地获取股票数据", "# 准备股票数据,为了实现动态图表,应该获取一只股票在全历史周期内的所有价格数据,并且在全周期上计算", "# 所需的均线以及指标数据,显示的时候只显示其中一部分即可,并且可以使用鼠标缩放平移", "# 因此_prepare_mpf_data()函数应该返回一个包含所有历史价格以及相关指标的DataFrame", "# 如果给出或获取的数据没有volume列,则生成空数据列" ]
[ { "param": "stock_data", "type": null }, { "param": "share_name", "type": null }, { "param": "stock", "type": null }, { "param": "start", "type": null }, { "param": "end", "type": null }, { "param": "asset_type", "type": null }, { "param": ...
{ "returns": [], "raises": [], "params": [ { "identifier": "stock_data", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "share_name", "type": null, "docstring": null, "docstrin...
8b29ae7edea36c26867999cdec4de16b7f1533b8
shepherdpp/qteasy
qteasy/_arg_validators.py
[ "CC0-1.0" ]
Python
_validate_vkwargs_dict
null
def _validate_vkwargs_dict(vkwargs): """ Check that we didn't make a typo in any of the things that should be the same for all vkwargs dict items: :param vkwargs: :return: """ for key, value in vkwargs.items(): if len(value) != 4: raise ValueError(f'Items != 2 in valid k...
Check that we didn't make a typo in any of the things that should be the same for all vkwargs dict items: :param vkwargs: :return:
Check that we didn't make a typo in any of the things that should be the same for all vkwargs dict items.
[ "Check", "that", "we", "didn", "'", "t", "make", "a", "typo", "in", "any", "of", "the", "things", "that", "should", "be", "the", "same", "for", "all", "vkwargs", "dict", "items", "." ]
def _validate_vkwargs_dict(vkwargs): for key, value in vkwargs.items(): if len(value) != 4: raise ValueError(f'Items != 2 in valid kwarg table, for kwarg {key}') if 'Default' not in value: raise ValueError(f'Missing "Default" value for kwarg {key}') if 'Validator' not...
[ "def", "_validate_vkwargs_dict", "(", "vkwargs", ")", ":", "for", "key", ",", "value", "in", "vkwargs", ".", "items", "(", ")", ":", "if", "len", "(", "value", ")", "!=", "4", ":", "raise", "ValueError", "(", "f'Items != 2 in valid kwarg table, for kwarg {key}...
Check that we didn't make a typo in any of the things that should be the same for all vkwargs dict items:
[ "Check", "that", "we", "didn", "'", "t", "make", "a", "typo", "in", "any", "of", "the", "things", "that", "should", "be", "the", "same", "for", "all", "vkwargs", "dict", "items", ":" ]
[ "\"\"\" Check that we didn't make a typo in any of the things\n that should be the same for all vkwargs dict items:\n\n :param vkwargs:\n :return:\n \"\"\"" ]
[ { "param": "vkwargs", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "vkwargs", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, ...
8b29ae7edea36c26867999cdec4de16b7f1533b8
shepherdpp/qteasy
qteasy/_arg_validators.py
[ "CC0-1.0" ]
Python
_initialize_config_kwargs
<not_specific>
def _initialize_config_kwargs(kwargs, vkwargs): """ Given a "valid kwargs table" and some kwargs, verify that each key-word is valid per the kwargs table, and that the value of the kwarg is the correct type. Fill a configuration dictionary with the default value for each kwarg, and then sub...
Given a "valid kwargs table" and some kwargs, verify that each key-word is valid per the kwargs table, and that the value of the kwarg is the correct type. Fill a configuration dictionary with the default value for each kwarg, and then substitute in any values that were provided as kwa...
Given a "valid kwargs table" and some kwargs, verify that each key-word is valid per the kwargs table, and that the value of the kwarg is the correct type. Fill a configuration dictionary with the default value for each kwarg, and then substitute in any values that were provided as kwargs and return the configuration ...
[ "Given", "a", "\"", "valid", "kwargs", "table", "\"", "and", "some", "kwargs", "verify", "that", "each", "key", "-", "word", "is", "valid", "per", "the", "kwargs", "table", "and", "that", "the", "value", "of", "the", "kwarg", "is", "the", "correct", "t...
def _initialize_config_kwargs(kwargs, vkwargs): config = ConfigDict() for key, value in vkwargs.items(): config[key] = value['Default'] config = _update_config_kwargs(config, kwargs) return config
[ "def", "_initialize_config_kwargs", "(", "kwargs", ",", "vkwargs", ")", ":", "config", "=", "ConfigDict", "(", ")", "for", "key", ",", "value", "in", "vkwargs", ".", "items", "(", ")", ":", "config", "[", "key", "]", "=", "value", "[", "'Default'", "]"...
Given a "valid kwargs table" and some kwargs, verify that each key-word is valid per the kwargs table, and that the value of the kwarg is the correct type.
[ "Given", "a", "\"", "valid", "kwargs", "table", "\"", "and", "some", "kwargs", "verify", "that", "each", "key", "-", "word", "is", "valid", "per", "the", "kwargs", "table", "and", "that", "the", "value", "of", "the", "kwarg", "is", "the", "correct", "t...
[ "\"\"\" Given a \"valid kwargs table\" and some kwargs, verify that each key-word\n is valid per the kwargs table, and that the value of the kwarg is the\n correct type. Fill a configuration dictionary with the default value\n for each kwarg, and then substitute in any values that were provide...
[ { "param": "kwargs", "type": null }, { "param": "vkwargs", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "kwargs", "type": null, "docstring": "keywords that is given by user", "docstring_tokens": [ "keywords", ...
8b29ae7edea36c26867999cdec4de16b7f1533b8
shepherdpp/qteasy
qteasy/_arg_validators.py
[ "CC0-1.0" ]
Python
_update_config_kwargs
<not_specific>
def _update_config_kwargs(config, kwargs): """ given existing configuration dict, verify that all kwargs are valid per kwargs table, and update the configuration dictionary :param config: configuration dictionary to be updated :param kwargs: kwargs that are to be updated :param vkwargs: valid k...
given existing configuration dict, verify that all kwargs are valid per kwargs table, and update the configuration dictionary :param config: configuration dictionary to be updated :param kwargs: kwargs that are to be updated :param vkwargs: valid keywords table used for validating given kwargs ...
given existing configuration dict, verify that all kwargs are valid per kwargs table, and update the configuration dictionary
[ "given", "existing", "configuration", "dict", "verify", "that", "all", "kwargs", "are", "valid", "per", "kwargs", "table", "and", "update", "the", "configuration", "dictionary" ]
def _update_config_kwargs(config, kwargs): vkwargs = _valid_qt_kwargs() for key in kwargs.keys(): value = _parse_string_kwargs(kwargs[key], key, vkwargs) if _validate_key_and_value(key, value): config[key] = value return config
[ "def", "_update_config_kwargs", "(", "config", ",", "kwargs", ")", ":", "vkwargs", "=", "_valid_qt_kwargs", "(", ")", "for", "key", "in", "kwargs", ".", "keys", "(", ")", ":", "value", "=", "_parse_string_kwargs", "(", "kwargs", "[", "key", "]", ",", "ke...
given existing configuration dict, verify that all kwargs are valid per kwargs table, and update the configuration dictionary
[ "given", "existing", "configuration", "dict", "verify", "that", "all", "kwargs", "are", "valid", "per", "kwargs", "table", "and", "update", "the", "configuration", "dictionary" ]
[ "\"\"\" given existing configuration dict, verify that all kwargs are valid\n per kwargs table, and update the configuration dictionary\n\n :param config: configuration dictionary to be updated\n :param kwargs: kwargs that are to be updated\n :param vkwargs: valid keywords table used for validating ...
[ { "param": "config", "type": null }, { "param": "kwargs", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "config", "type": null, "docstring": "configuration dictionary to be updated", "docstring_tokens": [ "config...
8b29ae7edea36c26867999cdec4de16b7f1533b8
shepherdpp/qteasy
qteasy/_arg_validators.py
[ "CC0-1.0" ]
Python
_parse_string_kwargs
<not_specific>
def _parse_string_kwargs(value, key, vkwargs): """ correct the type of value to the same of default type :param value: :param key: :param vkwargs: :return: """ # 为防止value的类型不正确,将value修改为正确的类型,与 vkwargs 的 # Default value 的类型相同 if key not in vkwargs: return value if not is...
correct the type of value to the same of default type :param value: :param key: :param vkwargs: :return:
correct the type of value to the same of default type
[ "correct", "the", "type", "of", "value", "to", "the", "same", "of", "default", "type" ]
def _parse_string_kwargs(value, key, vkwargs): if key not in vkwargs: return value if not isinstance(value, str): return value default_value = vkwargs[key]['Default'] if (not isinstance(default_value, str)) and (default_value is not None): import ast value = ast.literal_e...
[ "def", "_parse_string_kwargs", "(", "value", ",", "key", ",", "vkwargs", ")", ":", "if", "key", "not", "in", "vkwargs", ":", "return", "value", "if", "not", "isinstance", "(", "value", ",", "str", ")", ":", "return", "value", "default_value", "=", "vkwar...
correct the type of value to the same of default type
[ "correct", "the", "type", "of", "value", "to", "the", "same", "of", "default", "type" ]
[ "\"\"\" correct the type of value to the same of default type\n\n :param value:\n :param key:\n :param vkwargs:\n :return:\n \"\"\"", "# 为防止value的类型不正确,将value修改为正确的类型,与 vkwargs 的", "# Default value 的类型相同" ]
[ { "param": "value", "type": null }, { "param": "key", "type": null }, { "param": "vkwargs", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "value", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, ...
8b29ae7edea36c26867999cdec4de16b7f1533b8
shepherdpp/qteasy
qteasy/_arg_validators.py
[ "CC0-1.0" ]
Python
_validate_key_and_value
<not_specific>
def _validate_key_and_value(key, value): """ given one key, validate the key according to vkwargs dict return True if the key is valid raise if the key is not valid :param key: :param value: :return: """ vkwargs = _valid_qt_kwargs() if key not in vkwargs: return Fals...
given one key, validate the key according to vkwargs dict return True if the key is valid raise if the key is not valid :param key: :param value: :return:
given one key, validate the key according to vkwargs dict return True if the key is valid raise if the key is not valid
[ "given", "one", "key", "validate", "the", "key", "according", "to", "vkwargs", "dict", "return", "True", "if", "the", "key", "is", "valid", "raise", "if", "the", "key", "is", "not", "valid" ]
def _validate_key_and_value(key, value): vkwargs = _valid_qt_kwargs() if key not in vkwargs: return False else: try: valid = vkwargs[key]['Validator'](value) except Exception as ex: ex.extra_info = f'kwarg {key} validator raised exception to value: {str(value)...
[ "def", "_validate_key_and_value", "(", "key", ",", "value", ")", ":", "vkwargs", "=", "_valid_qt_kwargs", "(", ")", "if", "key", "not", "in", "vkwargs", ":", "return", "False", "else", ":", "try", ":", "valid", "=", "vkwargs", "[", "key", "]", "[", "'V...
given one key, validate the key according to vkwargs dict return True if the key is valid raise if the key is not valid
[ "given", "one", "key", "validate", "the", "key", "according", "to", "vkwargs", "dict", "return", "True", "if", "the", "key", "is", "valid", "raise", "if", "the", "key", "is", "not", "valid" ]
[ "\"\"\" given one key, validate the key according to vkwargs dict\n return True if the key is valid\n raise if the key is not valid\n\n :param key:\n :param value:\n :return:\n \"\"\"", "# ---------------------------------------------------------------", "# At this point , if we h...
[ { "param": "key", "type": null }, { "param": "value", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "key", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "...
8b29ae7edea36c26867999cdec4de16b7f1533b8
shepherdpp/qteasy
qteasy/_arg_validators.py
[ "CC0-1.0" ]
Python
_bypass_kwarg_validation
<not_specific>
def _bypass_kwarg_validation(value): ''' For some kwargs, we either don't know enough, or the validation is too complex to make it worth while, so we bypass kwarg validation. If the kwarg is invalid, then eventually an exception will be raised at the time the kwarg value is actually...
For some kwargs, we either don't know enough, or the validation is too complex to make it worth while, so we bypass kwarg validation. If the kwarg is invalid, then eventually an exception will be raised at the time the kwarg value is actually used.
For some kwargs, we either don't know enough, or the validation is too complex to make it worth while, so we bypass kwarg validation. If the kwarg is invalid, then eventually an exception will be raised at the time the kwarg value is actually used.
[ "For", "some", "kwargs", "we", "either", "don", "'", "t", "know", "enough", "or", "the", "validation", "is", "too", "complex", "to", "make", "it", "worth", "while", "so", "we", "bypass", "kwarg", "validation", ".", "If", "the", "kwarg", "is", "invalid", ...
def _bypass_kwarg_validation(value): return True
[ "def", "_bypass_kwarg_validation", "(", "value", ")", ":", "return", "True" ]
For some kwargs, we either don't know enough, or the validation is too complex to make it worth while, so we bypass kwarg validation.
[ "For", "some", "kwargs", "we", "either", "don", "'", "t", "know", "enough", "or", "the", "validation", "is", "too", "complex", "to", "make", "it", "worth", "while", "so", "we", "bypass", "kwarg", "validation", "." ]
[ "''' For some kwargs, we either don't know enough, or\n the validation is too complex to make it worth while,\n so we bypass kwarg validation. If the kwarg is\n invalid, then eventually an exception will be\n raised at the time the kwarg value is actually used.\n '''" ]
[ { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "value", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8b29ae7edea36c26867999cdec4de16b7f1533b8
shepherdpp/qteasy
qteasy/_arg_validators.py
[ "CC0-1.0" ]
Python
_kwarg_not_implemented
null
def _kwarg_not_implemented(value): ''' If you want to list a kwarg in a valid_kwargs dict for a given function, but you have not yet, or don't yet want to, implement the kwarg; or you simply want to (temporarily) disable the kwarg, then use this function as the kwarg validator ''' ra...
If you want to list a kwarg in a valid_kwargs dict for a given function, but you have not yet, or don't yet want to, implement the kwarg; or you simply want to (temporarily) disable the kwarg, then use this function as the kwarg validator
If you want to list a kwarg in a valid_kwargs dict for a given function, but you have not yet, or don't yet want to, implement the kwarg; or you simply want to (temporarily) disable the kwarg, then use this function as the kwarg validator
[ "If", "you", "want", "to", "list", "a", "kwarg", "in", "a", "valid_kwargs", "dict", "for", "a", "given", "function", "but", "you", "have", "not", "yet", "or", "don", "'", "t", "yet", "want", "to", "implement", "the", "kwarg", ";", "or", "you", "simpl...
def _kwarg_not_implemented(value): raise NotImplementedError('kwarg NOT implemented.')
[ "def", "_kwarg_not_implemented", "(", "value", ")", ":", "raise", "NotImplementedError", "(", "'kwarg NOT implemented.'", ")" ]
If you want to list a kwarg in a valid_kwargs dict for a given function, but you have not yet, or don't yet want to, implement the kwarg; or you simply want to (temporarily) disable the kwarg, then use this function as the kwarg validator
[ "If", "you", "want", "to", "list", "a", "kwarg", "in", "a", "valid_kwargs", "dict", "for", "a", "given", "function", "but", "you", "have", "not", "yet", "or", "don", "'", "t", "yet", "want", "to", "implement", "the", "kwarg", ";", "or", "you", "simpl...
[ "''' If you want to list a kwarg in a valid_kwargs dict for a given\n function, but you have not yet, or don't yet want to, implement\n the kwarg; or you simply want to (temporarily) disable the kwarg,\n then use this function as the kwarg validator\n '''" ]
[ { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "value", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d6843e7f7c7146454e311976f5931cb6d16b1ce3
shepherdpp/qteasy
qteasy/database.py
[ "CC0-1.0" ]
Python
data_types
<not_specific>
def data_types(self): """ return all available data types of current data """ return None
return all available data types of current data
return all available data types of current data
[ "return", "all", "available", "data", "types", "of", "current", "data" ]
def data_types(self): return None
[ "def", "data_types", "(", "self", ")", ":", "return", "None" ]
return all available data types of current data
[ "return", "all", "available", "data", "types", "of", "current", "data" ]
[ "\"\"\" return all available data types of current data\n\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d6843e7f7c7146454e311976f5931cb6d16b1ce3
shepherdpp/qteasy
qteasy/database.py
[ "CC0-1.0" ]
Python
date_range
<not_specific>
def date_range(self): """ return the date range of existing data :return: """ return None
return the date range of existing data :return:
return the date range of existing data
[ "return", "the", "date", "range", "of", "existing", "data" ]
def date_range(self): return None
[ "def", "date_range", "(", "self", ")", ":", "return", "None" ]
return the date range of existing data
[ "return", "the", "date", "range", "of", "existing", "data" ]
[ "\"\"\" return the date range of existing data\n\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
d6843e7f7c7146454e311976f5931cb6d16b1ce3
shepherdpp/qteasy
qteasy/database.py
[ "CC0-1.0" ]
Python
highest_freq
<not_specific>
def highest_freq(self): """ return the highest frequency of data :return: """ return None
return the highest frequency of data :return:
return the highest frequency of data
[ "return", "the", "highest", "frequency", "of", "data" ]
def highest_freq(self): return None
[ "def", "highest_freq", "(", "self", ")", ":", "return", "None" ]
return the highest frequency of data
[ "return", "the", "highest", "frequency", "of", "data" ]
[ "\"\"\" return the highest frequency of data\n\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
d6843e7f7c7146454e311976f5931cb6d16b1ce3
shepherdpp/qteasy
qteasy/database.py
[ "CC0-1.0" ]
Python
lowest_freq
<not_specific>
def lowest_freq(self): """ return the lowest frequency of data :return: """ return None
return the lowest frequency of data :return:
return the lowest frequency of data
[ "return", "the", "lowest", "frequency", "of", "data" ]
def lowest_freq(self): return None
[ "def", "lowest_freq", "(", "self", ")", ":", "return", "None" ]
return the lowest frequency of data
[ "return", "the", "lowest", "frequency", "of", "data" ]
[ "\"\"\" return the lowest frequency of data\n\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
d6843e7f7c7146454e311976f5931cb6d16b1ce3
shepherdpp/qteasy
qteasy/database.py
[ "CC0-1.0" ]
Python
info
null
def info(self): """ print out information of current object :return: """ raise NotImplementedError
print out information of current object :return:
print out information of current object
[ "print", "out", "information", "of", "current", "object" ]
def info(self): raise NotImplementedError
[ "def", "info", "(", "self", ")", ":", "raise", "NotImplementedError" ]
print out information of current object
[ "print", "out", "information", "of", "current", "object" ]
[ "\"\"\" print out information of current object\n\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
d6843e7f7c7146454e311976f5931cb6d16b1ce3
shepherdpp/qteasy
qteasy/database.py
[ "CC0-1.0" ]
Python
regenerate
null
def regenerate(self): """ refresh some data or all data in local files, meaning re-download all data online to keep local data up-to-date :return: """ raise NotImplementedError
refresh some data or all data in local files, meaning re-download all data online to keep local data up-to-date :return:
refresh some data or all data in local files, meaning re-download all data online to keep local data up-to-date
[ "refresh", "some", "data", "or", "all", "data", "in", "local", "files", "meaning", "re", "-", "download", "all", "data", "online", "to", "keep", "local", "data", "up", "-", "to", "-", "date" ]
def regenerate(self): raise NotImplementedError
[ "def", "regenerate", "(", "self", ")", ":", "raise", "NotImplementedError" ]
refresh some data or all data in local files, meaning re-download all data online to keep local data up-to-date
[ "refresh", "some", "data", "or", "all", "data", "in", "local", "files", "meaning", "re", "-", "download", "all", "data", "online", "to", "keep", "local", "data", "up", "-", "to", "-", "date" ]
[ "\"\"\" refresh some data or all data in local files, meaning re-download\n all data online to keep local data up-to-date\n\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
d6843e7f7c7146454e311976f5931cb6d16b1ce3
shepherdpp/qteasy
qteasy/database.py
[ "CC0-1.0" ]
Python
file_exists
<not_specific>
def file_exists(self, file_name): """ returns whether a file exists or not :param file_name: :return: """ if not isinstance(file_name, str): raise TypeError(f'file_name name must be a string, {file_name} is not a valid input!') return path.exists(QT_ROOT_PATH...
returns whether a file exists or not :param file_name: :return:
returns whether a file exists or not
[ "returns", "whether", "a", "file", "exists", "or", "not" ]
def file_exists(self, file_name): if not isinstance(file_name, str): raise TypeError(f'file_name name must be a string, {file_name} is not a valid input!') return path.exists(QT_ROOT_PATH + LOCAL_DATA_FOLDER + file_name + LOCAL_DATA_FILE_EXT)
[ "def", "file_exists", "(", "self", ",", "file_name", ")", ":", "if", "not", "isinstance", "(", "file_name", ",", "str", ")", ":", "raise", "TypeError", "(", "f'file_name name must be a string, {file_name} is not a valid input!'", ")", "return", "path", ".", "exists"...
returns whether a file exists or not
[ "returns", "whether", "a", "file", "exists", "or", "not" ]
[ "\"\"\" returns whether a file exists or not\n\n :param file_name:\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "file_name", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
d6843e7f7c7146454e311976f5931cb6d16b1ce3
shepherdpp/qteasy
qteasy/database.py
[ "CC0-1.0" ]
Python
new_file
<not_specific>
def new_file(self, file_name, dataframe): """ create given dataframe into a new file with file_name :param dataframe: :param file_name: :return: """ if not isinstance(file_name, str): raise TypeError(f'file_name name must be a string, {file_name} is not a val...
create given dataframe into a new file with file_name :param dataframe: :param file_name: :return:
create given dataframe into a new file with file_name
[ "create", "given", "dataframe", "into", "a", "new", "file", "with", "file_name" ]
def new_file(self, file_name, dataframe): if not isinstance(file_name, str): raise TypeError(f'file_name name must be a string, {file_name} is not a valid input!') df = self.validated_dataframe(dataframe) if self.file_exists(file_name): raise FileExistsError(f'the file wi...
[ "def", "new_file", "(", "self", ",", "file_name", ",", "dataframe", ")", ":", "if", "not", "isinstance", "(", "file_name", ",", "str", ")", ":", "raise", "TypeError", "(", "f'file_name name must be a string, {file_name} is not a valid input!'", ")", "df", "=", "se...
create given dataframe into a new file with file_name
[ "create", "given", "dataframe", "into", "a", "new", "file", "with", "file_name" ]
[ "\"\"\" create given dataframe into a new file with file_name\n\n :param dataframe:\n :param file_name:\n :return:\n \"\"\"", "# dataframe.to_csv(QT_ROOT_PATH + LOCAL_DATA_FOLDER + file_name + LOCAL_DATA_FILE_EXT)" ]
[ { "param": "self", "type": null }, { "param": "file_name", "type": null }, { "param": "dataframe", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
d6843e7f7c7146454e311976f5931cb6d16b1ce3
shepherdpp/qteasy
qteasy/database.py
[ "CC0-1.0" ]
Python
open_file
<not_specific>
def open_file(self, file_name): """ open the file with name file_name and return the df :param file_name: :return: """ if not isinstance(file_name, str): raise TypeError(f'file_name name must be a string, {file_name} is not a valid input!') if not self.file_e...
open the file with name file_name and return the df :param file_name: :return:
open the file with name file_name and return the df
[ "open", "the", "file", "with", "name", "file_name", "and", "return", "the", "df" ]
def open_file(self, file_name): if not isinstance(file_name, str): raise TypeError(f'file_name name must be a string, {file_name} is not a valid input!') if not self.file_exists(file_name): raise FileNotFoundError(f'File {QT_ROOT_PATH + LOCAL_DATA_FOLDER + file_name + LOCAL_DATA_...
[ "def", "open_file", "(", "self", ",", "file_name", ")", ":", "if", "not", "isinstance", "(", "file_name", ",", "str", ")", ":", "raise", "TypeError", "(", "f'file_name name must be a string, {file_name} is not a valid input!'", ")", "if", "not", "self", ".", "file...
open the file with name file_name and return the df
[ "open", "the", "file", "with", "name", "file_name", "and", "return", "the", "df" ]
[ "\"\"\" open the file with name file_name and return the df\n\n :param file_name:\n :return:\n \"\"\"", "# df = pd.read_csv(QT_ROOT_PATH + LOCAL_DATA_FOLDER + file_name + LOCAL_DATA_FILE_EXT, index_col=0)" ]
[ { "param": "self", "type": null }, { "param": "file_name", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
d6843e7f7c7146454e311976f5931cb6d16b1ce3
shepherdpp/qteasy
qteasy/database.py
[ "CC0-1.0" ]
Python
overwrite_file
<not_specific>
def overwrite_file(self, file_name, df): """ save df as file name or overwrite file name if file_name already exists :param file_name: :param df: :return: """ if not isinstance(file_name, str): raise TypeError(f'file_name name must be a string, {file_name} is...
save df as file name or overwrite file name if file_name already exists :param file_name: :param df: :return:
save df as file name or overwrite file name if file_name already exists
[ "save", "df", "as", "file", "name", "or", "overwrite", "file", "name", "if", "file_name", "already", "exists" ]
def overwrite_file(self, file_name, df): if not isinstance(file_name, str): raise TypeError(f'file_name name must be a string, {file_name} is not a valid input!') df = self.validated_dataframe(df) df.reset_index().to_feather(QT_ROOT_PATH + LOCAL_DATA_FOLDER + file_name + LOCAL_DATA_F...
[ "def", "overwrite_file", "(", "self", ",", "file_name", ",", "df", ")", ":", "if", "not", "isinstance", "(", "file_name", ",", "str", ")", ":", "raise", "TypeError", "(", "f'file_name name must be a string, {file_name} is not a valid input!'", ")", "df", "=", "sel...
save df as file name or overwrite file name if file_name already exists
[ "save", "df", "as", "file", "name", "or", "overwrite", "file", "name", "if", "file_name", "already", "exists" ]
[ "\"\"\" save df as file name or overwrite file name if file_name already exists\n\n :param file_name:\n :param df:\n :return:\n \"\"\"", "# df.to_csv(QT_ROOT_PATH + LOCAL_DATA_FOLDER + file_name + LOCAL_DATA_FILE_EXT)" ]
[ { "param": "self", "type": null }, { "param": "file_name", "type": null }, { "param": "df", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
d6843e7f7c7146454e311976f5931cb6d16b1ce3
shepherdpp/qteasy
qteasy/database.py
[ "CC0-1.0" ]
Python
merge_file
null
def merge_file(self, file_name, df): """ merge some data stored in df into file_name, the downloaded data are stored in df, a pandas DataFrame, that might contain more rows and/or columns than the original file. if downloaded data contains more rows than original file, the original ...
merge some data stored in df into file_name, the downloaded data are stored in df, a pandas DataFrame, that might contain more rows and/or columns than the original file. if downloaded data contains more rows than original file, the original file will be extended to contain more rows ...
merge some data stored in df into file_name, the downloaded data are stored in df, a pandas DataFrame, that might contain more rows and/or columns than the original file. if downloaded data contains more rows than original file, the original file will be extended to contain more rows of data, those columns that are no...
[ "merge", "some", "data", "stored", "in", "df", "into", "file_name", "the", "downloaded", "data", "are", "stored", "in", "df", "a", "pandas", "DataFrame", "that", "might", "contain", "more", "rows", "and", "/", "or", "columns", "than", "the", "original", "f...
def merge_file(self, file_name, df): original_df = self.open_file(file_name) new_index = df.index new_columns = df.columns index_expansion = any(index not in original_df.index for index in new_index) column_expansion = any(column not in original_df.columns for column in new_colum...
[ "def", "merge_file", "(", "self", ",", "file_name", ",", "df", ")", ":", "original_df", "=", "self", ".", "open_file", "(", "file_name", ")", "new_index", "=", "df", ".", "index", "new_columns", "=", "df", ".", "columns", "index_expansion", "=", "any", "...
merge some data stored in df into file_name, the downloaded data are stored in df, a pandas DataFrame, that might contain more rows and/or columns than the original file.
[ "merge", "some", "data", "stored", "in", "df", "into", "file_name", "the", "downloaded", "data", "are", "stored", "in", "df", "a", "pandas", "DataFrame", "that", "might", "contain", "more", "rows", "and", "/", "or", "columns", "than", "the", "original", "f...
[ "\"\"\" merge some data stored in df into file_name,\n\n the downloaded data are stored in df, a pandas DataFrame, that might\n contain more rows and/or columns than the original file.\n\n if downloaded data contains more rows than original file, the original\n file will be extended to c...
[ { "param": "self", "type": null }, { "param": "file_name", "type": null }, { "param": "df", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
d6843e7f7c7146454e311976f5931cb6d16b1ce3
shepherdpp/qteasy
qteasy/database.py
[ "CC0-1.0" ]
Python
validated_dataframe
<not_specific>
def validated_dataframe(self, df): """ checks the df input, and validate its index and prepare sorting :param df: :return: """ if not isinstance(df, pd.DataFrame): raise TypeError(f'data should be a pandas df, the input is not in valid format!') try: ...
checks the df input, and validate its index and prepare sorting :param df: :return:
checks the df input, and validate its index and prepare sorting
[ "checks", "the", "df", "input", "and", "validate", "its", "index", "and", "prepare", "sorting" ]
def validated_dataframe(self, df): if not isinstance(df, pd.DataFrame): raise TypeError(f'data should be a pandas df, the input is not in valid format!') try: df.rename(index=pd.to_datetime, inplace=True) df.sort_index() df.index.name='date' except...
[ "def", "validated_dataframe", "(", "self", ",", "df", ")", ":", "if", "not", "isinstance", "(", "df", ",", "pd", ".", "DataFrame", ")", ":", "raise", "TypeError", "(", "f'data should be a pandas df, the input is not in valid format!'", ")", "try", ":", "df", "."...
checks the df input, and validate its index and prepare sorting
[ "checks", "the", "df", "input", "and", "validate", "its", "index", "and", "prepare", "sorting" ]
[ "\"\"\" checks the df input, and validate its index and prepare sorting\n\n :param df:\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "df", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
d6843e7f7c7146454e311976f5931cb6d16b1ce3
shepherdpp/qteasy
qteasy/database.py
[ "CC0-1.0" ]
Python
file_datetime_range
<not_specific>
def file_datetime_range(self, file_name): """ get the datetime range start and end of the file :param file_name: :return: """ df = self.open_file(file_name) return df.index[0], df.index[-1]
get the datetime range start and end of the file :param file_name: :return:
get the datetime range start and end of the file
[ "get", "the", "datetime", "range", "start", "and", "end", "of", "the", "file" ]
def file_datetime_range(self, file_name): df = self.open_file(file_name) return df.index[0], df.index[-1]
[ "def", "file_datetime_range", "(", "self", ",", "file_name", ")", ":", "df", "=", "self", ".", "open_file", "(", "file_name", ")", "return", "df", ".", "index", "[", "0", "]", ",", "df", ".", "index", "[", "-", "1", "]" ]
get the datetime range start and end of the file
[ "get", "the", "datetime", "range", "start", "and", "end", "of", "the", "file" ]
[ "\"\"\" get the datetime range start and end of the file\n\n :param file_name:\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "file_name", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
c191f54e8df3fd4c02d34aac2777bc96d9a810d2
shepherdpp/qteasy
qteasy/history.py
[ "CC0-1.0" ]
Python
as_type
<not_specific>
def as_type(self, dtype): """ Convert the data type of current HistoryPanel to another :param dtype: :return: """ ALL_DTYPES = ['float', 'int'] if not self.is_empty: assert isinstance(dtype, str), f'InputError, dtype should be a string, got {type(dtype)}' ...
Convert the data type of current HistoryPanel to another :param dtype: :return:
Convert the data type of current HistoryPanel to another
[ "Convert", "the", "data", "type", "of", "current", "HistoryPanel", "to", "another" ]
def as_type(self, dtype): ALL_DTYPES = ['float', 'int'] if not self.is_empty: assert isinstance(dtype, str), f'InputError, dtype should be a string, got {type(dtype)}' assert dtype in ALL_DTYPES, f'data type {dtype} is not recognized or not supported!' self._values = ...
[ "def", "as_type", "(", "self", ",", "dtype", ")", ":", "ALL_DTYPES", "=", "[", "'float'", ",", "'int'", "]", "if", "not", "self", ".", "is_empty", ":", "assert", "isinstance", "(", "dtype", ",", "str", ")", ",", "f'InputError, dtype should be a string, got {...
Convert the data type of current HistoryPanel to another
[ "Convert", "the", "data", "type", "of", "current", "HistoryPanel", "to", "another" ]
[ "\"\"\" Convert the data type of current HistoryPanel to another\n\n :param dtype:\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "dtype", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
c191f54e8df3fd4c02d34aac2777bc96d9a810d2
shepherdpp/qteasy
qteasy/history.py
[ "CC0-1.0" ]
Python
plot
null
def plot(self, *args, **kwargs): """plot current HistoryPanel, settings according to args and kwargs """ raise NotImplementedError
plot current HistoryPanel, settings according to args and kwargs
plot current HistoryPanel, settings according to args and kwargs
[ "plot", "current", "HistoryPanel", "settings", "according", "to", "args", "and", "kwargs" ]
def plot(self, *args, **kwargs): raise NotImplementedError
[ "def", "plot", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "raise", "NotImplementedError" ]
plot current HistoryPanel, settings according to args and kwargs
[ "plot", "current", "HistoryPanel", "settings", "according", "to", "args", "and", "kwargs" ]
[ "\"\"\"plot current HistoryPanel, settings according to args and kwargs\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c191f54e8df3fd4c02d34aac2777bc96d9a810d2
shepherdpp/qteasy
qteasy/history.py
[ "CC0-1.0" ]
Python
ohlc
null
def ohlc(self, *args, **kwargs): """ plot ohlc chart with data in the HistoryPanel, check data availability before plotting :param args: :param kwargs: :return: """ raise NotImplementedError
plot ohlc chart with data in the HistoryPanel, check data availability before plotting :param args: :param kwargs: :return:
plot ohlc chart with data in the HistoryPanel, check data availability before plotting
[ "plot", "ohlc", "chart", "with", "data", "in", "the", "HistoryPanel", "check", "data", "availability", "before", "plotting" ]
def ohlc(self, *args, **kwargs): raise NotImplementedError
[ "def", "ohlc", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "raise", "NotImplementedError" ]
plot ohlc chart with data in the HistoryPanel, check data availability before plotting
[ "plot", "ohlc", "chart", "with", "data", "in", "the", "HistoryPanel", "check", "data", "availability", "before", "plotting" ]
[ "\"\"\" plot ohlc chart with data in the HistoryPanel, check data availability before plotting\n\n :param args:\n :param kwargs:\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
c191f54e8df3fd4c02d34aac2777bc96d9a810d2
shepherdpp/qteasy
qteasy/history.py
[ "CC0-1.0" ]
Python
renko
null
def renko(self, *args, **kwargs): """ plot renko chart with data in the HistoryPanel, check data availability before plotting :param args: :param kwargs: :return: """ raise NotImplementedError
plot renko chart with data in the HistoryPanel, check data availability before plotting :param args: :param kwargs: :return:
plot renko chart with data in the HistoryPanel, check data availability before plotting
[ "plot", "renko", "chart", "with", "data", "in", "the", "HistoryPanel", "check", "data", "availability", "before", "plotting" ]
def renko(self, *args, **kwargs): raise NotImplementedError
[ "def", "renko", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "raise", "NotImplementedError" ]
plot renko chart with data in the HistoryPanel, check data availability before plotting
[ "plot", "renko", "chart", "with", "data", "in", "the", "HistoryPanel", "check", "data", "availability", "before", "plotting" ]
[ "\"\"\" plot renko chart with data in the HistoryPanel, check data availability before plotting\n\n :param args:\n :param kwargs:\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
c191f54e8df3fd4c02d34aac2777bc96d9a810d2
shepherdpp/qteasy
qteasy/history.py
[ "CC0-1.0" ]
Python
to_csv
null
def to_csv(self): """ save a HistoryPanel object to csv file :return: """ raise NotImplementedError
save a HistoryPanel object to csv file :return:
save a HistoryPanel object to csv file
[ "save", "a", "HistoryPanel", "object", "to", "csv", "file" ]
def to_csv(self): raise NotImplementedError
[ "def", "to_csv", "(", "self", ")", ":", "raise", "NotImplementedError" ]
save a HistoryPanel object to csv file
[ "save", "a", "HistoryPanel", "object", "to", "csv", "file" ]
[ "\"\"\" save a HistoryPanel object to csv file\n\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
c191f54e8df3fd4c02d34aac2777bc96d9a810d2
shepherdpp/qteasy
qteasy/history.py
[ "CC0-1.0" ]
Python
to_hdf
null
def to_hdf(self): """ save a HistoryPanel object to hdf file :return: """ raise NotImplementedError
save a HistoryPanel object to hdf file :return:
save a HistoryPanel object to hdf file
[ "save", "a", "HistoryPanel", "object", "to", "hdf", "file" ]
def to_hdf(self): raise NotImplementedError
[ "def", "to_hdf", "(", "self", ")", ":", "raise", "NotImplementedError" ]
save a HistoryPanel object to hdf file
[ "save", "a", "HistoryPanel", "object", "to", "hdf", "file" ]
[ "\"\"\" save a HistoryPanel object to hdf file\n\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
c191f54e8df3fd4c02d34aac2777bc96d9a810d2
shepherdpp/qteasy
qteasy/history.py
[ "CC0-1.0" ]
Python
to_db
null
def to_db(self): """ save HistoryPanel to a database or to update the database with current HistoryPanel :return: """ raise NotImplementedError
save HistoryPanel to a database or to update the database with current HistoryPanel :return:
save HistoryPanel to a database or to update the database with current HistoryPanel
[ "save", "HistoryPanel", "to", "a", "database", "or", "to", "update", "the", "database", "with", "current", "HistoryPanel" ]
def to_db(self): raise NotImplementedError
[ "def", "to_db", "(", "self", ")", ":", "raise", "NotImplementedError" ]
save HistoryPanel to a database or to update the database with current HistoryPanel
[ "save", "HistoryPanel", "to", "a", "database", "or", "to", "update", "the", "database", "with", "current", "HistoryPanel" ]
[ "\"\"\" save HistoryPanel to a database or to update the database with current HistoryPanel\n\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...