simulariumio/cellpack/cellpack_converter.py
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 cellpack => simularium
        # user is supposed to send in the cellPACK scale factor
        # if they send one in at all.
        input_data.meta_data.scale_factor *= 0.1

        # load the data from Cellpack output JSON file
        recipe_loader = RecipeLoader(input_data.recipe_file_path)
        recipe_data = recipe_loader.recipe_data
        results_data = json.loads(input_data.results_file.get_contents())
        all_ingredients = recipe_loader.get_all_ingredients(results_data)

        box_center = CellpackConverter._get_box_center(recipe_data)
        agent_data = CellpackConverter._process_ingredients(
            all_ingredients,
            time_step_index,
            input_data.meta_data.scale_factor,
            box_center,
            input_data.geometry_type,
            input_data.handedness,
            input_data.geometry_url,
            input_data.display_data,
        )
        # parse
        box_size = np.array(CellpackConverter._get_boxsize(recipe_data))
        input_data.meta_data._set_box_size(box_size)
        # set camera position based on bounding box
        CellpackConverter._update_meta_data(input_data.meta_data, box_size)

        # # create TrajectoryData
        input_data.spatial_units.multiply(1.0 / input_data.meta_data.scale_factor)
        return TrajectoryData(
            meta_data=input_data.meta_data,
            agent_data=agent_data,
            time_units=input_data.time_units,
            spatial_units=input_data.spatial_units,
            plots=input_data.plots,
        )

        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 = json.loads(input_data.results_file.get_contents())
        all_ingredients = recipe_loader.get_all_ingredients(results_data)
        box_center = CellpackConverter._get_box_center(recipe_data)
        agent_data = CellpackConverter._process_ingredients(
            all_ingredients,
            time_step_index,
            input_data.meta_data.scale_factor,
            box_center,
            input_data.geometry_type,
            input_data.handedness,
            input_data.geometry_url,
            input_data.display_data,
        )
        box_size = np.array(CellpackConverter._get_boxsize(recipe_data))
        input_data.meta_data._set_box_size(box_size)
        CellpackConverter._update_meta_data(input_data.meta_data, box_size)
        input_data.spatial_units.multiply(1.0 / input_data.meta_data.scale_factor)
        return TrajectoryData(
            meta_data=input_data.meta_data,
            agent_data=agent_data,
            time_units=input_data.time_units,
            spatial_units=input_data.spatial_units,
            plots=input_data.plots,
        )
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 = json . loads ( input_data . results_file . get_contents ( ) ) all_ingredients = recipe_loader . get_all_ingredients ( results_data ) box_center = CellpackConverter . _get_box_center ( recipe_data ) agent_data = CellpackConverter . _process_ingredients ( all_ingredients , time_step_index , input_data . meta_data . scale_factor , box_center , input_data . geometry_type , input_data . handedness , input_data . geometry_url , input_data . display_data , ) box_size = np . array ( CellpackConverter . _get_boxsize ( recipe_data ) ) input_data . meta_data . _set_box_size ( box_size ) CellpackConverter . _update_meta_data ( input_data . meta_data , box_size ) input_data . spatial_units . multiply ( 1.0 / input_data . meta_data . scale_factor ) return TrajectoryData ( meta_data = input_data . meta_data , agent_data = agent_data , time_units = input_data . time_units , spatial_units = input_data . spatial_units , plots = input_data . plots , )
Return a TrajectoryData object containing the Cellpack data
Return a TrajectoryData object containing the Cellpack data
"""
        Return a TrajectoryData object containing the Cellpack data
        """ # 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 from Cellpack output JSON file # parse # set camera position based on bounding box # # create TrajectoryData
input_data
CellpackData