This module handles comparison.
The comparer module is responsible for analyzing the effects of changing a variable. It takes care of running the simulations, compiling the data, and producing graphs.
Runs a bunch of simulations with slight differences and aggregates the results.
sim_config (str) the template configuration file for the experiment
cmp_config (str) the comparison configuration file for the experiment
name (str): the name of the comparison; defaults to Experiment
data (str): the data directory; defaults to the current directory.
identical_genomes (bool): whether all of the trials simulations should start out with the same set of genomes (identical generation 0)
Aggregates data from multiple simulations into a comparative-analyzer directory.
When a comparison is run, it creates an analyzer directory for each type of simulation. AnalyzerAggregator combines them by putting the columns next to each other. For example, combining three simulations, each with one column of data, produces a data file with three columns - one for each simulation.
Compiles all data files into a single comparative-analyzer dir.
Compile a single type of data file.
metric (str): the filename to read and write
read_style (str):
if one_col, then the metric is assumed to have only one column.
and they are each written to “<metric_name>-<col#>”
Takes a comparison’s analyzer directory and provides methods for plotting the data.
Draws the chemical environment and saves as an image.
Plots a bar graph of the final values of a metric.
Each var_attr is a bar on the x axis. metric is the y axis. The value of each bar is the value of metric at the last generation.
Input files contain 2d numpy arrays containing values for metric, where each row is a generation and each column corresponds to a value of self.vary_attrs.
Plots a scatter plot of the number of generations it took a metric to pass a threshold value.
These graphs are specified in the ‘threshold-metrics’ section of a simulation’s configuration file.
Saves images of the plots of all of the metrics
Plots time_spent_in_gaussian data.
Data should only be present if num_runs == 0. Data files are located in folders named comparative-analyzer/sim-x/, where x is a number associated with each simulation.
Reads a comparison configuration file.
Returns a tuple of (tuple of option names, list of tuples of values to use)
Create a sim config file by replacing options in base_config.
Replaces options in base_config with values from replacement_values and saves the resulting simulation configuration file to out_filename.
Used to create a sim.cfg config file from a cmp.cfg comparison config.
Gets the list of files associated with metric.
Returns [str..]: the filenames that match.