From 10f2cae46f68d80d76e01848a44ef00b83deb59c Mon Sep 17 00:00:00 2001 From: Saurabh Mogre Date: Tue, 20 Feb 2024 16:39:45 -0800 Subject: [PATCH] Process arguments inside `doloop` function --- cellpack/autopack/Analysis.py | 52 ++++++++++++++++------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/cellpack/autopack/Analysis.py b/cellpack/autopack/Analysis.py index f1d281e5..03bfec63 100644 --- a/cellpack/autopack/Analysis.py +++ b/cellpack/autopack/Analysis.py @@ -33,7 +33,7 @@ from cellpack.autopack.plotly_result import PlotlyAnalysis from cellpack.autopack.upy import colors as col from cellpack.autopack.upy.colors import map_colors -from cellpack.autopack.utils import check_paired_key, get_paired_key +from cellpack.autopack.utils import check_paired_key, get_paired_key, get_seed_list from cellpack.autopack.writers import Writer from cellpack.autopack.writers.ImageWriter import ImageWriter import concurrent.futures @@ -2342,17 +2342,10 @@ def pack_one_seed( def doloop( self, - number_of_packings, + recipe_data, + packing_config_data, bounding_box, get_distance_distribution=True, - plot_figures=True, - show_grid=True, - seed_list=None, - config_name="default", - recipe_version="1.0.0", - image_export_options=None, - parallel=False, - save_gradient_data_as_image=False, ): """ Runs multiple packings of the same recipe in a loop. This workflow @@ -2363,26 +2356,17 @@ def doloop( Parameters ---------- - number_of_packing : int - Number of repeats of a packing. Default: 1 - bounding_box : np.ndarray - bounding box from the environment + recipe_data: dict + Dictionary containing recipe data + packing_config_data: dict + Dictionary containing packing configuration data + bounding_box: list + List of two lists containing the minimum and maximum coordinates + of the bounding box get_distance_distribution: bool - specify whether to calculate distance distributions - render: bool - ??? - plot_figures: bool - specify whether to save figures generated by the analyses - show_grid: bool - specify whether to display packing grid in browser - fbox_bb: ??? - ??? - seed_list: List - list of seeds to use for the packing (for reproducibility) - config_name: string - name of the configuration used for the packing - recipe_version: string - version of the recipe used for the packing + Whether to calculate and store distance and angle distributions + seed_list: list + List of seeds to use for packings Outputs ------- @@ -2393,6 +2377,16 @@ def doloop( distributions as applicable for each seed, and a combined image across seeds """ + number_of_packings = packing_config_data["number_of_packings"] + plot_figures = packing_config_data.get("save_plot_figures", True) + show_grid = packing_config_data["show_grid_plot"] + image_export_options = packing_config_data.get("image_export_options") + parallel = packing_config_data.get("parallel", False) + save_gradient_data_as_image = packing_config_data.get( + "save_gradient_data_as_image", False + ) + + seed_list = get_seed_list(packing_config_data, recipe_data) if seed_list is None: seed_list = self.getHaltonUnique(number_of_packings) packing_basename = self.env.base_name