opynfield.plotting package¶
Submodules¶
opynfield.plotting.plot_group_comparisons module¶
- opynfield.plotting.plot_group_comparisons.generate_fig_title(path: str, x_measure: str, y_measure: str, model_fit: bool, error: bool, extension: str) str¶
This function generates a figure title to save the figure in from the component parts
- Parameters
path (str) – path to the plot folder
x_measure (str) – the x-axis of the plot
y_measure (str) – the y-axis of the plot
model_fit (bool) – whether the plot includes a model fit
error (bool) – whether the plot includes error bars
extension (str) – what file extension / format to save the plot in
- Returns
the path to save the plot in
- Return type
str
- opynfield.plotting.plot_group_comparisons.plot_all_group_comparisons(group_averages: dict[str, dict], group_fits: dict[str, dict[str, dict[str, pandas.core.frame.DataFrame]]], model_params: dict[str, dict[str, opynfield.config.model_settings.ModelSpecification]], test_defaults: opynfield.config.defaults_settings.Defaults, plot_settings: opynfield.config.plot_settings.PlotSettings, user_config: opynfield.config.user_input.UserInput)¶
This function coordinates the plotting of all the x-measure (both time and coverage-measure) vs y-measure relationships
- Parameters
group_averages (dict[str, dict]) – the group average data to use, indexed by group and then x measure
group_fits (dict[str, dict[str, dict[str, pd.DataFrame]]]) – the model parameter fits to use, indexed by group, x-measure, and y-measure
model_params (dict[str, dict[str, ModelSpecification]]) – the model settings to use, indexed by x measure and y measure
test_defaults (Defaults) – the default settings to use
plot_settings (PlotSettings) – the plot settings to use
user_config (UserInput) – the user inputs to use
- opynfield.plotting.plot_group_comparisons.plot_cmeasure_comparison(x_measure: str, y_measure: str, cmeasure_averages: dict[str, pandas.core.frame.DataFrame], group_fits: dict[str, dict[str, dict[str, pandas.core.frame.DataFrame]]], specs: opynfield.config.model_settings.ModelSpecification, plot_settings: opynfield.config.plot_settings.PlotSettings, user_input: opynfield.config.user_input.UserInput)¶
This function plots all the group averages against each other for a coverage-measure vs y-measure relationship
- Parameters
x_measure (str) – the coverage-measure
y_measure (str) – the y-measure
cmeasure_averages (dict[str, dict[str, pd.DataFrame]]) – the averages to use to plot, indexed by group and y-measure
group_fits (dict[str, dict[str, dict[str, pd.DataFrame]]]) – the model parameters to use, indexed by group and y-measure
specs (ModelSpecification) – the model settings to use
plot_settings (PlotSettings) – the plot settings to use
user_input (UserInput) – the user inputs to use
- opynfield.plotting.plot_group_comparisons.plot_time_comparison(x_measure: str, y_measure: str, time_averages: dict[str, dict[str, pandas.core.frame.DataFrame]], fits: dict[str, dict[str, dict[str, pandas.core.frame.DataFrame]]], specs: opynfield.config.model_settings.ModelSpecification, plot_settings: opynfield.config.plot_settings.PlotSettings, user_inputs: opynfield.config.user_input.UserInput)¶
This function plots all the group averages against each other for a time vs y-measure relationship
- Parameters
x_measure (str) – the x-measure (time)
y_measure (str) – the y-measure
time_averages (dict[str, dict[str, pd.DataFrame]]) – the averages to use to plot, indexed by group and y-measure
fits (dict[str, dict[str, dict[str, pd.DataFrame]]]) – the model parameters to use, indexed by group and y-measure
specs (ModelSpecification) – the model settings to use
plot_settings (PlotSettings) – the plot settings to use
user_inputs (UserInput) – the user inputs to use
opynfield.plotting.plot_individuals module¶
- opynfield.plotting.plot_individuals.generate_fig_title(path: str, i: int, x_measure: str, y_measure: str, model_fit: bool, extension: str)¶
This function generates a figure title to save the figure from the component parts
- Parameters
path (str) – path to the plot folder
i (int) – which individual in the group is being plotted
x_measure (str) – the x-axis of the plot
y_measure (str) – the y-axis of the plot
model_fit (bool) – whether the plot includes the model fit
extension (str) – what file extension / format to save the plot in
- Returns
the path that the plot should be saved in
- Return type
str
- opynfield.plotting.plot_individuals.generate_individual_equation_str(params, display_parts)¶
This function generates the equation of the best fit model from the model display parts and the truncated parameter values
- Parameters
params (list[float]) – the parameter fits
display_parts (list[str]) – the display parts from the model information
- Returns
the full equation string
- Return type
str
- opynfield.plotting.plot_individuals.plot_all_individuals(measures: dict[str, dict[str, pandas.core.frame.DataFrame]], model_params: dict[str, dict[str, dict[str, pandas.core.frame.DataFrame]]], model_info: dict[str, dict[str, opynfield.config.model_settings.ModelSpecification]], defaults: opynfield.config.defaults_settings.Defaults, plot_settings: opynfield.config.plot_settings.PlotSettings, user_config: opynfield.config.user_input.UserInput)¶
This function coordinates the plotting of all the x-measure vs y-measure relationships from all individuals from all groups
- Parameters
measures (dict[str, dict[str, pd.DataFrame]]) – the y-measure data indexed by group and y-measure name
model_params (dict[str, dict[str, dict[str, pd.DataFrame]]]) – the model fit parameters indexed by group, x-measure, and y-measure
model_info (dict[str, dict[str, ModelSpecification]]) – the model settings to use, indexed by x-measure and y-measure
defaults (Defaults) – the default settings to use
plot_settings (PlotSettings) – the plot settings to use
user_config (UserInput) – the user inputs to use
- opynfield.plotting.plot_individuals.plot_all_individuals_by_cmeasure(x_measure: str, group: str, group_measures: dict[str, pandas.core.frame.DataFrame], group_model_params: dict[str, pandas.core.frame.DataFrame], model_info: dict[str, opynfield.config.model_settings.ModelSpecification], defaults: opynfield.config.defaults_settings.Defaults, plot_settings: opynfield.config.plot_settings.PlotSettings, user_config: opynfield.config.user_input.UserInput)¶
This function coordinates plotting all the individuals in a group for a coverage-measure vs y-measure relationship
- Parameters
x_measure (str) – the coverage measure name
group (str) – the group name
group_measures (dict[str, pd.DataFrame]) – the y-measure data use, indexed by y-measure
group_model_params (dict[str, pd.DataFrame]) – the model parameters to use, indexed by y-measure
model_info (dict[str, ModelSpecification]) – the model settings to use, indexed by the y-measure
defaults (Defaults) – the default settings to use
plot_settings (PlotSettings) – the plot settings to use
user_config (UserInput) – the user inputs to use
- opynfield.plotting.plot_individuals.plot_all_individuals_by_time(group: str, group_measures: dict[str, pandas.core.frame.DataFrame], group_model_params: dict[str, pandas.core.frame.DataFrame], model_info: dict[str, opynfield.config.model_settings.ModelSpecification], defaults: opynfield.config.defaults_settings.Defaults, plot_settings: opynfield.config.plot_settings.PlotSettings, user_config: opynfield.config.user_input.UserInput)¶
This function coordinates plotting all the individuals in a group for a time vs y-measure relationship
- Parameters
group (str) – the group name
group_measures (dict[str, pd.DataFrame]) – the y-measure data use, indexed by y-measure
group_model_params (dict[str, pd.DataFrame]) – the model parameters to use, indexed by y-measure
model_info (dict[str, ModelSpecification]) – the model settings to use, indexed by the y-measure
defaults (Defaults) – the default settings to use
plot_settings (PlotSettings) – the plot settings to use
user_config (UserInput) – the user inputs to use
- opynfield.plotting.plot_individuals.plot_cmeasure_measure(x_measure: str, group: str, i: int, measure: str, measure_data_x: pandas.core.frame.DataFrame, measure_data_y: pandas.core.frame.DataFrame, model_params: pandas.core.frame.DataFrame, model_info: opynfield.config.model_settings.ModelSpecification, plot_settings: opynfield.config.plot_settings.PlotSettings, user_config: opynfield.config.user_input.UserInput)¶
This function plots an individual’s data for a coverage-measure vs y-measure relationship
- Parameters
x_measure (str) – the coverage measure name
group (str) – the group name
i (int) – the individual number within its group
measure (str) – the y-measure
measure_data_x (pd.DataFrame) – the coverage-measure data
measure_data_y (pd.DataFrame) – the y-measure data
model_params (pd.DataFrame) – the model parameters to use, indexed by group and y-measure
model_info (ModelSpecification) – the model settings to use
plot_settings (PlotSettings) – the plot settings to use
user_config (UserInput) – the user inputs to use
- opynfield.plotting.plot_individuals.plot_individual_trace(track: opynfield.calculate_measures.standard_track.StandardTrack, i: int, group: str, plot_settings: opynfield.config.plot_settings.PlotSettings, user_input: opynfield.config.user_input.UserInput)¶
This function plots the trace (tracking trajectory) of an individual
- Parameters
track (StandardTrack) – the track whose trace you are plotting
i (int) – the individual number within the tracks group
group (str) – the group name to which the track belongs
plot_settings (PlotSettings) – the plot settings to use
user_input (UserInput) – the user inputs to use
- opynfield.plotting.plot_individuals.plot_time_measure(group: str, i: int, measure: str, measure_data: pandas.core.frame.DataFrame, model_params: pandas.core.frame.DataFrame, model_info: opynfield.config.model_settings.ModelSpecification, plot_settings: opynfield.config.plot_settings.PlotSettings, user_config: opynfield.config.user_input.UserInput)¶
This function plots an individual’s data for a time vs y-measure relationship
- Parameters
group (str) – the group name
i (int) – the individual number within its group
measure (str) – the y-measure
measure_data (pd.DataFrame) – the y-measure data
model_params (pd.DataFrame) – the model parameters to use, indexed by group and y-measure
model_info (ModelSpecification) – the model settings to use
plot_settings (PlotSettings) – the plot settings to use
user_config (UserInput) – the user inputs to use
- opynfield.plotting.plot_individuals.plot_traces(tracks_by_groups: collections.defaultdict[str, list[opynfield.calculate_measures.standard_track.StandardTrack]], plot_settings: opynfield.config.plot_settings.PlotSettings, user_input: opynfield.config.user_input.UserInput)¶
This function coordinated plotting the traces of all individual tracks in all groups
- Parameters
tracks_by_groups (defaultdict[str, list[StandardTrack]]) – a dictionary of all the individuals to plot, indexed by the group to which they belong
plot_settings (PlotSettings) – the plot settings to use
user_input (UserInput) – the user inputs to use
- opynfield.plotting.plot_individuals.truncate(n, decimals=0)¶
This function trims the exact parameter fit value to a set number of decimal places for display on a plot
- Parameters
n (float) – the parameter
decimals (int) – the number of decimal places to trim to
- Returns
the trimmed parameter value
- Return type
float
opynfield.plotting.plot_solo_groups module¶
- opynfield.plotting.plot_solo_groups.generate_fig_title(path: str, x_measure: str, y_measure: str, model_fit: bool, error: bool, extension: str)¶
This function generates a figure title to save a single group plot at, based on the component parts
- Parameters
path (str) – the path to the results plot folder
x_measure (str) – the x-measure of the plot
y_measure (str) – the y-measure of the plot
model_fit (bool) – whether the plot includes the model fit
error (bool) – whether the plot includes the group average error bars
extension – the file extension / format to save the plot in
- Returns
the path to save the plot at
- Return type
str
- opynfield.plotting.plot_solo_groups.generate_group_equation_str(fit_params, display_parts)¶
This function generates the equation of the best fit model from the model display parts and the truncated parameter values
- Parameters
fit_params (list[float]) – the parameter fits
display_parts (list[str]) – the display parts from the model information
- Returns
the full equation string
- Return type
str
- opynfield.plotting.plot_solo_groups.plot_all_solo_groups(group_averages: dict[str, dict], group_fits: dict[str, dict[str, dict[str, pandas.core.frame.DataFrame]]], model_params: dict[str, dict[str, opynfield.config.model_settings.ModelSpecification]], test_defaults: opynfield.config.defaults_settings.Defaults, plot_settings: opynfield.config.plot_settings.PlotSettings, user_config: opynfield.config.user_input.UserInput)¶
This function coordinates the plotting of all the x-measure vs y-measure relationships for each group
- Parameters
group_averages (dict[str, dict]) – the group averages to plot, indexed by x-measure, then group (then y-measure)
group_fits (dict[str, dict[str, dict[str, pd.DataFrame]]]) – the y-fit values (based on the model fit parameters) indexed by group, time, and y-measure
model_params (dict[str, dict[str, ModelSpecification]]) – the model settings to use, indexed by x-measure and y-measure
test_defaults (Defaults) – the default settings to use
plot_settings (PlotSettings) – the plot settings to use
user_config (UserInput) – the user inputs to use
- opynfield.plotting.plot_solo_groups.plot_solo_group_by_cmeasure(by_coverage: pandas.core.frame.DataFrame, defaults: opynfield.config.defaults_settings.Defaults, cmeasure: str, plot_settings: opynfield.config.plot_settings.PlotSettings, model_params: dict[str, opynfield.config.model_settings.ModelSpecification], group_fits: dict[str, pandas.core.frame.DataFrame], group: str, user_config: opynfield.config.user_input.UserInput)¶
This function plots a single group’s average coverage-measure vs y-measure relationship for each coverage averaged y-measure
- Parameters
by_coverage (pd.DataFrame) – the x-measure data (and error) and the y-measure data (and error) for the group
defaults (Defaults) – the default settings to use
cmeasure (str) – the coverage measure being used as x-axis
plot_settings (PlotSettings) – the plot settings to use
model_params (dict[str, ModelSpecification]) – the model settings to use, indexed by y-measure
group_fits (dict[str, pd.DataFrame]) – the y-fit data from the model fits, indexed by y-measure
group (str) – the whose data you are plotting
user_config (UserInput) – the user inputs to use
- opynfield.plotting.plot_solo_groups.plot_solo_group_by_time(by_time: dict[str, pandas.core.frame.DataFrame], defaults: opynfield.config.defaults_settings.Defaults, plot_settings: opynfield.config.plot_settings.PlotSettings, model_params: dict[str, opynfield.config.model_settings.ModelSpecification], group_fits: dict[str, pandas.core.frame.DataFrame], group: str, user_config: opynfield.config.user_input.UserInput)¶
This function coordinates the plotting of all time vs y-measure relationships for a single group
- Parameters
by_time (dict[str, pd.DataFrame]) – the y-measure data (and error) of the group, indexed by y-measure
defaults (Defaults) – the default settings to use
plot_settings (PlotSettings) – the plot settings to use
model_params (dict[str, ModelSpecification]) – the model settings to use, indexed by y-measure
group_fits (dict[str, pd.DataFrame]) – the y-fit data from the model fit parameters, indexed by y-measure
group – the group to plot
group – str
user_config (UserInput) – the user inputs to use
- opynfield.plotting.plot_solo_groups.plot_solo_group_measure_by_time(measure_by_time: pandas.core.frame.DataFrame, plot_settings: opynfield.config.plot_settings.PlotSettings, model_specs: opynfield.config.model_settings.ModelSpecification, group_fits: pandas.core.frame.DataFrame, measure: str, group: str, user_config: opynfield.config.user_input.UserInput)¶
This function plots a single group’s average time vs y-measure relationship
- Parameters
measure_by_time (pd.DataFrame) – the y-measure data (and error) for the group
plot_settings (PlotSettings) – the plot settings to use
model_specs (ModelSpecification) – the model settings to use
group_fits (pd.DataFrame) – the y-fit data from the model fits
measure (str) – the y-measure to plot
group (str) – the whose data you are plotting
user_config (UserInput) – the user inputs to use
- opynfield.plotting.plot_solo_groups.truncate(n, decimals=0)¶
This function trims the exact parameter fit value to a set number of decimal places for display on a plot
- Parameters
n (float) – the parameter
decimals (int) – the number of decimal places to trim to
- Returns
the trimmed parameter value
- Return type
float
opynfield.plotting.plot_solo_groups_with_individuals module¶
- opynfield.plotting.plot_solo_groups_with_individuals.generate_view_title(path: str, x_measure: str, y_measure: str, individual_models: bool, group_model: bool, group_error: bool, extension: str)¶
This function generates the title to save a plot as from the component parts
- Parameters
path (str) – the path to the result plot folder
x_measure (str) – the x-measure of the plot
y_measure (str) – the y-measure of the plot
individual_models (bool) – whether the models of the individuals that make up the group are plotted
group_model (bool) – whether the model of the group average is plotted
group_error (bool) – whether the error of the group average is plotted
extension (str) – the file extension / format to save the plot in
- Returns
the path to save the plot at
- Return type
str
- opynfield.plotting.plot_solo_groups_with_individuals.plot_components_of_solo_groups(individuals: dict[str, dict[str, pandas.core.frame.DataFrame]], individual_fits: dict[str, dict[str, dict[str, pandas.core.frame.DataFrame]]], groups: dict[str, dict], group_fits: dict[str, dict[str, dict[str, pandas.core.frame.DataFrame]]], model_specs: dict[str, dict[str, opynfield.config.model_settings.ModelSpecification]], defaults: opynfield.config.defaults_settings.Defaults, plot_settings: opynfield.config.plot_settings.PlotSettings, user_inputs: opynfield.config.user_input.UserInput)¶
This function coordinates the plotting of all the groups x-measure vs y-measure averages with the component individuals x-measure vs y-measure relationships
- Parameters
individuals (dict[str, dict[str, pd.DataFrame]]) – the component individual y-measure data, indexed by group and y-measure
individual_fits (dict[str, dict[str, dict[str, pd.DataFrame]]]) – the component individual model fit parameters, indexed by group, x-measure, and y-measure
groups (dict[str, dict]) – the group average data, indexed by group (and y-measure for time)
group_fits (dict[str, dict[str, dict[str, pd.DataFrame]]]) – the group average model fits, indexed by group, x-measure, and y-measure
model_specs (dict[str, dict[str, ModelSpecification]]) – the model settings to use, indexed by x-measure and y-measure
defaults (Defaults) – the default settings to use
plot_settings (PlotSettings) – the plot settings to use
user_inputs (UserInput) – the user inputs to use
- opynfield.plotting.plot_solo_groups_with_individuals.plot_group_individual_comparison_cmeasure(group: str, x_measure: str, y_measure: str, individuals_x: pandas.core.frame.DataFrame, individuals_y: pandas.core.frame.DataFrame, individuals_params: pandas.core.frame.DataFrame, group_ys_df: pandas.core.frame.DataFrame, group_params: pandas.core.frame.DataFrame, model_spec: opynfield.config.model_settings.ModelSpecification, plot_settings: opynfield.config.plot_settings.PlotSettings, user_inputs: opynfield.config.user_input.UserInput)¶
This function plots a group’s coverage-measure vs y-measure average and all the component individual coverage-measure vs y-measure relationships
- Parameters
group (str) – the group name
x_measure (str) – the x-measure in the plot
y_measure (str) – the y-measure in the plot
individuals_x (pd.DataFrame) – the coverage data from the component individuals
individuals_y (pd.DataFrame) – the y-measure data from the component individuals
individuals_params (pd.DataFrame) – the parameters for the individual model fits
group_ys_df (pd.DataFrame) – the group average (and error) data
group_params (pd.DataFrame) – the group average model fit parameters
model_spec (ModelSpecification) – the model settings to use
plot_settings (PlotSettings) – the plot settings to use
user_inputs (UserInput) – the user inputs to use
- opynfield.plotting.plot_solo_groups_with_individuals.plot_group_individual_comparison_time(group: str, x_measure: str, y_measure: str, individuals_y: pandas.core.frame.DataFrame, individuals_params: pandas.core.frame.DataFrame, group_y: pandas.core.frame.DataFrame, group_params: pandas.core.frame.DataFrame, model_spec: opynfield.config.model_settings.ModelSpecification, plot_settings: opynfield.config.plot_settings.PlotSettings, user_inputs: opynfield.config.user_input.UserInput)¶
This function plots a group’s coverage-measure vs y-measure average and all the component individual coverage-measure vs y-measure relationships
- Parameters
group (str) – the group name
x_measure (str) – the x-measure in the plot
y_measure (str) – the y-measure in the plot
individuals_y (pd.DataFrame) – the y-measure data from the component individuals
individuals_params (pd.DataFrame) – the parameters for the individual model fits
group_y (pd.DataFrame) – the group average (and error) data
group_params (pd.DataFrame) – the group average model fit parameters
model_spec (ModelSpecification) – the model settings to use
plot_settings (PlotSettings) – the plot settings to use
user_inputs (UserInput) – the user inputs to use