Source code for cytocalc.csmframe

#! /usr/bin/env python3

import warnings
from cytocalc.frame_analysis.network import FrameAnalyzerNetwork


[docs] class CSMFrame: """ Class representing a single frame of a simulation. The data extracted from a frame file is stored in frame.data as a pandas object. """ def __init__(self, pandas_obj, **kwargs): self.data = pandas_obj self._npobj = self._get_pos_nparray() self.time = None # time after simulation started self.network = FrameAnalyzerNetwork(self)
[docs] def _get_pos_nparray(self): """ obtains 3D position frome parsed data. If simulation is 2D or 1D other dimensions are set to 0 """ obj = self.data if "posX" not in obj.columns: return None if "posY" not in obj.columns: obj["posY"] = 0 if "posZ" not in obj.columns: obj["posZ"] = 0 return obj[["posX", "posY", "posZ"]].to_numpy(dtype=float)
[docs] def compute_com(self): """returns centre of mass of all filaments together (uniform mass)""" warnings.warn("Deprecated. Use FrameAnalyzerNetwork(frame).center_of_mass() instead", DeprecationWarning) return self.network.center_of_mass()
[docs] def compute_radius(self): """returns a measure of "network radius" of filaments (see appendix of Belmonte et al. Mol Syst Biol. 2017 Sep 27;13(9):941. doi: 10.15252/msb.20177796 in https://pmc.ncbi.nlm.nih.gov/articles/instance/5615920/bin/MSB-13-941-s001.pdf)""" warnings.warn("Deprecated. Use FrameAnalyzerNetwork(frame).radius() instead", DeprecationWarning) return self.network.radius()