Production Configuration#

Modules provide functionality to configure a simulation production. This includes the derivation of energy, viewcone radius, and core scatter ranges and related production-configuration helpers used by the supported workflows.

derive_corsika_limits#

Derive CORSIKA limits from trigger histograms.

production_configuration.derive_corsika_limits.compute_lower_energy_limit(histograms, threshold_fraction)[source]#

Compute the lower energy limit in TeV based on the threshold fraction.

Parameters:
histogramsEventDataHistograms

Histograms.

threshold_fractionfloat

Fraction of the stable peak used as threshold.

Returns:
astropy.units.Quantity

Lower energy limit.

production_configuration.derive_corsika_limits.generate_corsika_limits_grid(args_dict=None, context=None)[source]#

Generate CORSIKA limits from precomputed trigger-histogram products.

Reads histograms, computes limits, optionally plots histograms, and writes results to ECSV files. A literal file or glob preserves the existing output behavior. A directory processes supported particle products independently and writes one result below a particle-specific subdirectory.

production_configuration.derive_corsika_limits.parse_allowed_losses(allowed_losses_args)[source]#

Parse repeatable –allowed_losses values for core/viewcone axes.

Parameters:
allowed_losses_argslist[str]

List of values in the form “axis,fraction,min_events”.

Returns:
dict

Mapping of axis name to dict with keys “loss_fraction” and “loss_min_events”.

production_configuration.derive_corsika_limits.validate_differential_loss_bins_per_decade(value)[source]#

Validate and return a non-negative differential-bin count.

Parameters:
valueint or str

Differential energy-bin count per decade.

Returns:
int

Validated bin count.

Raises:
ValueError

If value is not a non-negative integer. The raised exception is also an argparse.ArgumentTypeError for detailed CLI diagnostics.

production_configuration.derive_corsika_limits.write_results(results, args_dict, allowed_losses, energy_threshold_fraction, context=None)[source]#

Write the computed limits as astropy table to file.

Parameters:
resultslist[dict]

List of computed limits.

allowed_lossesdict

Per-axis loss settings for core_distance/angular_distance.

energy_threshold_fractionfloat

Fraction used for deriving the lower energy threshold.

corsika_limits_lookup#

Lookup-table access and interpolation for CORSIKA production limits.

class production_configuration.corsika_limits_lookup.CorsikaLimitsLookup(lookup_table, array_layout_name=None)[source]#

Read and interpolate CORSIKA limits for production grids.

Parameters:
lookup_tablestr or Path

Path to the lookup-table ECSV file.

array_layout_namestr, optional

Array layout name used to select lookup-table rows.

interpolate_point(zenith, azimuth, nsb=1.0)[source]#

Interpolate lookup-table limits for a single point.

Parameters:
zenithfloat or Quantity

Zenith angle.

azimuthfloat or Quantity

Azimuth angle.

nsbfloat or Quantity, optional

Night-sky background rate stored in the lookup table.

Returns:
dict

Interpolated lower-energy threshold, scatter radius, and viewcone radius.

load_matching_lookup_arrays()[source]#

Load and filter lookup-table arrays for the selected array layout.

Returns:
dict

Lookup arrays for interpolation.

prepare_point_interpolators()[source]#

Prepare lookup arrays for per-point interpolation.

Returns:
dict

Interpolators keyed by lookup quantity.

production_configuration.corsika_limits_lookup.attach_lookup_limits_to_point(point, limits, lookup_field_units=None)[source]#

Attach interpolated CORSIKA limits to a grid point.

trigger_histograms#

Build and load trigger-histogram products from reduced event data.

production_configuration.trigger_histograms.discover_event_data_groups(event_data_directory)[source]#

Discover reduced event-data files and group partitioned products by filename.

Parameters:
event_data_directorystr or pathlib.Path

Directory containing direct-child reduced event-data HDF5 files.

Returns:
list[tuple[str, list[pathlib.Path]]]

Sorted (group_name, files) pairs. A group name is the file stem with a trailing .part<digits> suffix removed.

Raises:
FileNotFoundError

If the input directory does not exist or is not a directory.

ValueError

If the directory does not contain matching reduced event-data files.

production_configuration.trigger_histograms.inspect_trigger_histogram_file(file_path, format_report=True)[source]#

Return trigger-histogram-specific consistency checks when applicable.

Parameters:
file_pathstr or Path

Path to the file to inspect.

format_reportbool, optional

Whether to format the report as human-readable text. Default is True.

Returns:
str or dict or None

Formatted report string, structured report dictionary, or None if the file does not contain trigger-histogram products.

production_configuration.trigger_histograms.load_dense_histogram_payloads(reference_file)[source]#

Load dense histograms grouped by reference id.

production_configuration.trigger_histograms.load_event_data_histograms(reference_file, array_names=None, production_indices=None)[source]#

Load finalized EventDataHistograms objects from a trigger-histogram HDF5 file.

Parameters:
reference_filestr or pathlib.Path

Path to the trigger-histogram HDF5 file.

array_nameslist[str], optional

Restrict loaded histograms to these array names.

production_indiceslist[int], optional

Restrict loaded histograms to these production indices.

Returns:
list[tuple[astropy.table.Row, EventDataHistograms]]

Metadata row and reconstructed histogram object for each reference.

production_configuration.trigger_histograms.load_trigger_histograms(reference_file)[source]#

Load trigger-histogram metadata and bin tables from HDF5.

Parameters:
reference_filestr or pathlib.Path

Path to the trigger-histogram HDF5 file.

Returns:
tuple[astropy.table.Table, astropy.table.Table]

Metadata table and per-bin histogram table read from the input file.

production_configuration.trigger_histograms.validate_derived_products(configuration)[source]#

Check histogram metadata, run coverage, and source freshness without publishing it.

production_configuration.trigger_histograms.validate_derived_workflow(applications)[source]#

Check trigger products owned by histogram-writer workflow steps.

production_configuration.trigger_histograms.write_trigger_histograms(args_dict, context=None)[source]#

Build trigger histograms and write them to file.

Parameters:
args_dictdict

Application arguments.

Returns:
tuple[astropy.table.Table, astropy.table.Table] or simtools.job_execution.job.SubmissionHandle

Metadata and per-bin histogram tables for explicit input patterns, or the submission handle for directory-mode jobs.

Raises:
ValueError

If the output file does not use an HDF5 suffix or no supported telescope selection is provided.

monte_carlo_statistics_estimator#

Estimate required Monte Carlo statistics from trigger histogram products.

production_configuration.monte_carlo_statistics_estimator.estimate_monte_carlo_statistics(args_dict=None, metadata=None, context=None)[source]#

Estimate required total thrown events for one or more trigger histograms.

Parameters:
args_dictdict, optional

Estimator configuration. Uses the active application configuration when omitted.

metadatadict, optional

Top-level product metadata to include in the ECSV header.

Returns:
astropy.table.Table

Results table containing required thrown-event estimates and limiting-bin diagnostics for each selected trigger histogram.

histogram_output_metadata#

Shared helpers for production outputs derived from trigger-histogram metadata.

production_configuration.histogram_output_metadata.extract_histogram_output_metadata(source, file_info_columns, include_array_name=False)[source]#

Return production-identifying metadata for one histogram-derived output row.

production_event_data_helpers#

Shared helpers for production workflows based on reduced event-data files.

production_configuration.production_event_data_helpers.accumulate_histograms_by_telescope_config(file_path, telescope_configs, *, energy_bins_per_decade, angular_distance_bin_count=100, angular_distance_bin_width=None, core_distance_bin_width=None, skip_invalid_event_data_files=False, fill_efficiency_histogram=False, collect_trigger_topology=False, minimum_triggered_telescopes=2)[source]#

Read one production once and accumulate histograms for all telescope configurations.

Parameters:
file_pathstr

Reduced event-data input path or glob pattern for one production.

telescope_configslist[dict]

Telescope configurations with array_name and normalized telescope_ids.

energy_bins_per_decadeint

Number of logarithmic energy bins per decade.

angular_distance_bin_countint, optional

Number of angular-distance bins used by the accumulators.

angular_distance_bin_widthastropy.units.Quantity, optional

Angular-distance bin width used to derive bins from broad-range viewcone limits.

core_distance_bin_widthastropy.units.Quantity, optional

Core-distance bin width used to derive a common physical grid across ranges.

skip_invalid_event_data_filesbool, optional

Skip malformed event-data files instead of aborting the run.

fill_efficiency_histogrambool, optional

Whether to finalize with efficiency histograms enabled.

collect_trigger_topologybool, optional

Whether to also collect trigger topology summaries.

minimum_triggered_telescopesint, optional

Minimum number of triggered telescopes within each telescope configuration.

Returns:
list[tuple]

One finalized (config, histograms) pair per telescope configuration, with a trigger-topology accumulator appended when collect_trigger_topology is set.

production_configuration.production_event_data_helpers.normalize_telescope_configs(telescope_configs)[source]#

Normalize telescope configurations to a list of array-name descriptors.

Parameters:
telescope_configsdict or list[dict]

Raw telescope configuration payload.

Returns:
list[dict]

List of dictionaries with array_name and normalized telescope_ids.

production_configuration.production_event_data_helpers.resolve_telescope_configs(args_dict, context=None)[source]#

Resolve telescope configurations from supported input options.

Parameters:
args_dictdict

Application arguments containing layout or array-element selection.

Returns:
dict or list[dict]

Telescope configuration payload returned by the chosen selector.

Raises:
ValueError

If no supported telescope selector is provided.

production_file_selection#

Discover, filter, group, and validate production metadata manifests.

class production_configuration.production_file_selection.ProductionFileGroup(configuration, run_numbers=<factory>, file_paths=<factory>, missing_run_numbers=<factory>, duplicate_run_numbers=<factory>, files_by_run_number=<factory>)[source]#

Selected production files sharing one simulation configuration.

class production_configuration.production_file_selection.ProductionManifest(path, data)[source]#

A loaded production metadata manifest and its file path.

property directory#

Return the manifest parent directory.

property run_number#

Return the run number recorded in this manifest.

production_configuration.production_file_selection.check_manifest(manifest)[source]#

Validate a manifest against its output directory and listed files.

production_configuration.production_file_selection.discover_manifests(production_path, manifest_name='simulate_prod_job_metadata.yml')[source]#

Load all production metadata manifests below a directory.

production_configuration.production_file_selection.discover_product_manifests(production_path, product_type, manifest_pattern='*.yml')[source]#

Load all manifests of one product type below a directory.

production_configuration.production_file_selection.filter_manifests(manifests, selections)[source]#

Return manifests matching all selection expressions.

production_configuration.production_file_selection.find_manifests(production_path, manifest_name='simulate_prod_job_metadata.yml')[source]#

Return sorted production metadata manifests below a directory.

production_configuration.production_file_selection.get_manifest_schema_metadata(product_type)[source]#

Return the current schema name and version for a manifest product type.

production_configuration.production_file_selection.group_selected_files(manifests, file_type='reduced_event_data')[source]#

Group selected files by all configuration fields except the run number.

production_configuration.production_file_selection.inventory_production_files(job_directory)[source]#

Return nested production outputs grouped by manifest file type.

Paths in the returned inventory are relative to job_directory so that manifests can describe the standard sim_telarray/runNNNNNN and corsika/runNNNNNN output layout.

production_configuration.production_file_selection.load_manifest(manifest_path)[source]#

Load and validate one production manifest YAML file.

production_configuration.production_file_selection.normalize_for_comparison(value)[source]#

Normalize quantities and containers for exact matching and grouping.

production_configuration.production_file_selection.resolve_relative_manifest_path(directory, relative_path)[source]#

Resolve one manifest-relative path and reject paths escaping the job directory.

production_configuration.production_file_selection.select_file_groups(production_path, selections=None, file_type='reduced_event_data', require_complete_runs=False, manifest_name='simulate_prod_job_metadata.yml')[source]#

Discover manifests, filter jobs, and group selected files by configuration.

production_configuration.production_file_selection.selection_summary(selection_result)[source]#

Return a compact summary string for logging or console output.

production_configuration.production_file_selection.stable_configuration_hash(value, length=8)[source]#

Return a short stable hash for normalized configuration data.

production_configuration.production_file_selection.validate_required_production_outputs(file_inventory, simulation_software, job_directory)[source]#

Require the principal simulation output before marking a job complete.

production_configuration.production_file_selection.values_match(value, expected)[source]#

Return whether a manifest value matches a command-line selection value.

production_configuration.production_file_selection.write_selection_file(selection_result, output_file)[source]#

Write selected file groups to a YAML file.

comparison#

Compare trigger-histogram products from simulation productions.

class production_configuration.comparison.ProductionDescriptor(label, input_files)[source]#

Descriptor for one production input provided.

class production_configuration.comparison.ProductionEventMetrics(label, trigger_combinations, telescope_participation, simulated_event_count, triggered_event_count, simulated_energies=<factory>, triggered_energies=<factory>, simulated_core_distances=<factory>, triggered_core_distances=<factory>, simulated_angular_distances=<factory>, triggered_angular_distances=<factory>, trigger_multiplicity=<factory>, per_type=<factory>, quantity_histograms=<factory>, trigger_multiplicity_histogram=<factory>)[source]#

Aggregated event-level metrics for one production.

class production_configuration.comparison.ProductionSignalMetrics(label, pedestals, signals, peak_timing, triggered_pixels)[source]#

Aggregated signal metrics for one production and telescope.

production_configuration.comparison.collect_production_metrics(production_descriptors, array_names=None)[source]#

Collect comparison metrics from trigger histogram files for each production.

Parameters:
production_descriptorslist[ProductionDescriptor]

Input descriptor for each production.

array_nameslist[str] or str, optional

Restrict loaded histogram references to these array layout names.

Returns:
list[ProductionEventMetrics]

Aggregated metrics per production.

production_configuration.comparison.collect_signal_metrics(production_descriptors, telescope_names=None)[source]#

Collect telescope-level signal metrics for each production.

Parameters:
production_descriptorslist[ProductionDescriptor]

Production descriptors containing sim_telarray input files.

telescope_namesstr or list[str], optional

Restrict the metrics to one or more telescope names. If omitted, all telescopes shared by the input files are processed.

Returns:
dict[str, list[ProductionSignalMetrics]]

Metrics grouped by telescope name, with one entry per production.

Raises:
ValueError

If a required telescope is absent or no event data is available for a telescope.

production_configuration.comparison.parse_production_arguments(production_arguments)[source]#

Parse repeated production arguments into validated descriptors.

Parameters:
production_argumentslist[list[str]]

Repeated --production arguments in the shape [label, patterns].

Returns:
list[ProductionDescriptor]

Validated and normalized production descriptors.

Raises:
ValueError

If configuration is malformed or does not contain at least two productions.

production_configuration.comparison.validate_comparison_inputs(applications, production_paths)[source]#

Check source coverage and freshness before trigger-product comparisons.

production_configuration.comparison.write_production_comparison(args_dict, output_directory)[source]#

Compare selected trigger-histogram productions and write their statistics.

Parameters:
args_dictdict

Application arguments, including either explicit production descriptors or metadata paths.

output_directorypathlib.Path

Directory in which comparison products are written.

resource_requirements#

Collect and summarize CORSIKA and sim_telarray resource records.

production_configuration.resource_requirements.collect_resource_requirements(production_path, selections=None, label='baseline', comparison_role=None)[source]#

Collect one resource row per recorded simulation process.

Parameters:
production_pathstr or pathlib.Path

Production directory containing job-* directories.

selectionslist[str], optional

Manifest selection expressions accepted by filter_manifests.

labelstr, optional

Label identifying this production in combined results.

comparison_rolestr, optional

Stable comparison role, either "baseline" or "candidate".

Returns:
tuple[list[dict], list[dict]]

Valid resource rows and diagnostics for resource records that cannot be used. Missing CORSIKA output files are represented by None.

production_configuration.resource_requirements.resource_table(rows)[source]#

Return resource rows as an ECSV-compatible Astropy table.

production_configuration.resource_requirements.summarize_resource_requirements(rows)[source]#

Return grouped summary statistics for resource rows.

The grouping dimensions deliberately exclude azimuth and run number, but preserve separate CORSIKA and sim_telarray values.

production_configuration.resource_requirements.write_markdown_report(summary, diagnostics, output_file)[source]#

Write a compact human-readable resource requirements report.

production_configuration.resource_requirements.write_resource_requirements(args_dict, output_directory, plotter)[source]#

Collect, write, and plot resource requirements for one or two productions.

Parameters:
args_dictdict

Compute-comparison application arguments.

output_directorypathlib.Path

Destination directory for result products.

plottercallable

Plot function accepting rows, output path, and figure formats.

Returns:
dict

Paths of the ECSV, JSON, Markdown, and plot outputs plus diagnostics.

production_definition#

Build and validate production definitions from resolved application options.

production_configuration.production_definition.production_definition_from_arguments(args_dict)[source]#

Create validated production data from resolved grid application arguments.

production_metadata#

Write and validate metadata manifests for completed simulation production jobs.

production_configuration.production_metadata.build_production_job_manifest(args_dict, simulator, output_directory, file_inventory=None, catalog_metadata=None, atmosphere_configuration=None)[source]#

Build a versioned production-job manifest from resolved simulation output.

Parameters:
args_dictdict

Resolved simulate_prod application arguments.

simulatorsimtools.simulator.Simulator

Simulator for the completed and validated run.

output_directorystr or pathlib.Path

Directory containing the packaged output files.

file_inventorydict, optional

Precomputed manifest file inventory. Used when backfilling existing jobs.

catalog_metadatadict, optional

Catalog metadata to store instead of deriving it from the simulator.

atmosphere_configurationdict, optional

Resolved atmosphere configuration to store instead of deriving it from the simulator.

Returns:
dict

Versioned production-job manifest used for downstream file selection.

production_configuration.production_metadata.build_simulation_job_metadata(args_dict, simulator, include_sct=True)[source]#

Build DIRAC catalog metadata from resolved simulation configuration.

Parameters:
args_dictdict

Resolved simulate_prod application arguments.

simulatorsimtools.simulator.Simulator

Simulator for the completed run.

include_sctbool, optional

Include the SCT-presence catalog field when the resolved array elements are available.

Returns:
dict

Job-level metadata using DIRAC file-catalog field names.

production_configuration.production_metadata.get_sim_telarray_event_counts(output_directory, file_inventory)[source]#

Return sim_telarray event counts without reading simtel output files.

Parameters:
output_directorystr or pathlib.Path

Directory containing the production outputs.

file_inventorydict

Manifest file inventory with relative paths grouped by file type.

Returns:
dict or None

Mapping with simulated_events and triggered_events when counts can be recovered from reduced-event HDF5 files or sim_telarray logs.

production_configuration.production_metadata.write_production_metadata(args_dict, context=None)[source]#

Write or validate production job metadata manifests.

Parameters:
args_dictdict

Application arguments containing production_path and, in write mode, job_grid_file.

contextRunContext, optional

Run context for model access.

grid#

Expand observation grids into full simulation job matrices.

Combines grids (from ProductionGridEngine or explicit axes) with primaries, interactions, model versions, energy ranges, and run counts into a complete job parameter set.

class production_configuration.grid.ProductionGridEngine(axes, coordinate_system='horizontal', observing_location=None, lookup_table=None, array_layout_name=None, lookup_nsb_rate=None)[source]#

Generate observation grids with direction-dependent CORSIKA physics limits.

convert_altaz_to_hadec(alt, az)[source]#

Convert Altitude/Azimuth (AltAz) coordinates to HA/Dec.

Parameters:
altfloat

Altitude angle in degrees.

azfloat

Azimuth angle in degrees.

Returns:
SimpleNamespace

Object exposing ha and dec angle attributes.

convert_coordinates(grid_points, keep_horizontal_coordinates=False)[source]#

Convert the grid points HA/Dec coordinates if necessary.

Parameters:
grid_pointslist of dict

List of grid points.

keep_horizontal_coordinatesbool

Keep zenith_angle and azimuth in the converted points.

Returns:
list of dict

The grid points with converted HA/Dec coordinates.

create_circular_binning(azimuth_range, num_bins)[source]#

Create bin centers for azimuth angles, handling circular wraparound.

Parameters:
azimuth_rangetuple

(min_azimuth, max_azimuth), can wrap around 0 deg.

num_binsint

Number of bins.

Returns:
np.ndarray

Array of bin centers.

generate_simulation_grid()[source]#

Generate a grid for the configured coordinate system.

production_configuration.grid.build_axes_dict_from_cli_args(args_dict)[source]#

Build ProductionGridEngine-compatible axes configuration from CLI arguments.

production_configuration.grid.build_job_grid_metadata(args_dict)[source]#

Build metadata stored alongside serialized executable job grids.

production_configuration.grid.build_observing_location(site, model_version, context=None)[source]#

Build observing location from the site model.

Parameters:
sitestr

Site name.

model_versionstr or list[str]

Model version used to read site coordinates.

contextRunContext, optional

Run configuration and model reader.

production_configuration.grid.build_production_grid_engine(args_dict, array_layout_name=None, model_version=None, context=None)[source]#

Build a production-grid engine from application arguments.

Parameters:
args_dictdict

Application arguments (axis definitions, site, model version, optional CORSIKA lookup table, array layout name).

array_layout_namestr, optional

Resolved array layout name; resolved from args_dict if omitted.

model_versionstr, optional

Model version for observing location, array layout, and NSB rate. Defaults to the first model version in args_dict.

contextRunContext, optional

Run configuration and model reader.

Returns:
ProductionGridEngine

Configured production-grid engine.

production_configuration.grid.build_simulation_jobs(args_dict, context=None)[source]#

Expand production config into full simulation job matrix.

Cartesian product of primaries, model versions, interactions, observation directions, energy ranges, and run counts. Energy ranges are clipped by direction-dependent CORSIKA limits.

Returns:
list[dict]

Each job: primary, model_version, interactions, directions (Alt/Az), energy_min/max (clipped), showers_per_run, run_number, scatter/viewcone values (clipped by physics limits).

production_configuration.grid.calculate_log_energy_midpoint(energy_range_pair)[source]#

Return the geometric-mean energy for an energy range pair.

production_configuration.grid.calculate_scaled_showers_per_run(energy_range_pair, baseline_showers_per_run, showers_per_run_power_law=None)[source]#

Return an energy-dependent showers per run value.

production_configuration.grid.calculate_zenith_scaled_showers_per_run(zenith_angle, baseline_showers_per_run, showers_per_run_scaling='fixed')[source]#

Return a zenith-angle-dependent showers per run value.

Parameters:
zenith_angleastropy.units.Quantity

Zenith angle for one simulation point.

baseline_showers_per_runint

Showers-per-run value before zenith-angle scaling.

showers_per_run_scalingstr

Scaling mode (‘fixed’ or ‘cosine_zenith’).

Returns:
int

Zenith-scaled showers-per-run value.

production_configuration.grid.ceil_with_tolerance(value)[source]#

Ceil a float while avoiding near-integer floating-point artifacts.

production_configuration.grid.directed_circular_span_degrees(axis_range)[source]#

Return the directed circular span in degrees; full-circle ranges give 360.0.

production_configuration.grid.generate_job_grid(args_dict, output_file, metadata=None, context=None)[source]#

Generate and serialize a production job grid.

Parameters:
args_dictdict

Production job-grid configuration arguments.

output_filestr or Path

Path to the ECSV file to write.

metadatadict, optional

Default metadata to include in the ECSV header.

contextRunContext, optional

Run configuration and model reader.

production_configuration.grid.normalize_energy_ranges(energy_range)[source]#

Normalize energy range argument to a list of (e_min, e_max) pairs.

production_configuration.grid.normalize_grid_axes(args_dict)[source]#

Return normalized grid axes for cartesian product expansion.

production_configuration.grid.renumber_job_rows(job_rows, run_number_offset)[source]#

Set output run numbers continuously.

Parameters:
job_rowslist[dict]

List of job rows to renumber.

run_number_offsetint

Offset to apply to the run numbers (first run number will be offset + 1).

Returns:
list[dict]

List of job rows with updated run numbers.

production_configuration.grid.resolve_single_model_version(model_version)[source]#

Resolve one model version for helpers that require a scalar version.

production_configuration.grid.scale_energy_max_for_zenith_angle(zenith_angle, energy_range_pair, energy_max_scaling=None)[source]#

Scale energy_max with zenith angle and return an updated energy range pair.

Parameters:
zenith_angleastropy.units.Quantity

Zenith angle for one simulation point.

energy_range_pairtuple

Tuple containing the minimum and maximum energy values.

energy_max_scalingtuple or None

Tuple containing the scaling index and reference energy, or None.

Returns:
tuple or None

Updated energy range pair, or None if the scaling results in an invalid range.

jobs_io#

Read and write executable job grids for production preparation.

production_configuration.jobs_io.build_job_grid_summary(rows)[source]#

Build a user-facing summary of generated job-grid values.

production_configuration.jobs_io.build_simulate_prod_job_specs(args_dict, rows, parser, metadata=None)[source]#

Build backend-neutral command jobs for production-grid rows.

Parameters:
args_dictdict

Controller application arguments.

rowslist[dict]

Deserialized production-grid rows.

parserargparse.ArgumentParser

Parser defining the nested simulate_prod command.

metadatadict, optional

Production-grid metadata.

Returns:
list[JobSpec]

Ordered command jobs that force local execution inside each worker.

production_configuration.jobs_io.format_quantity_field(rows, key, summary_unit=None, *, log_wording=False)[source]#

Format one quantity field across rows as a single value or a range.

log_wording selects the sentence style used in log messages instead of the summary style used in the job-grid metadata.

production_configuration.jobs_io.job_grid_row_to_simulate_prod_args(job_row, metadata=None)[source]#

Convert an in-memory job grid row to simulate_prod argument format.

Callers are responsible for not combining these production-defining values ambiguously with independently supplied production arguments.

Parameters:
job_rowdict

A single deserialized job row as returned by read_job_grid().

metadatadict, optional

Job grid metadata as returned alongside the rows. When provided, site and simulation_software are included in the result.

Returns:
dict

Argument dictionary compatible with simulate_prod args_dict keys.

production_configuration.jobs_io.read_job_grid(input_file)[source]#

Read executable job rows from ECSV input.

Parameters:
input_filestr or Path

Input file path.

Returns:
tuple[list[dict], dict]

Deserialized job rows and metadata.

production_configuration.jobs_io.resolve_job_grid_arguments(args_dict, config_sources, parser)[source]#

Merge selected job-grid row values into args after rejecting ambiguous input.

production_configuration.jobs_io.serialize_job_grid(job_rows, output_file, metadata=None)[source]#

Serialize executable job rows to ECSV output.

Parameters:
job_rowslist[dict]

Job rows in the in-memory schema.

output_filestr or Path

Output file path. Must use the .ecsv suffix.

metadatadict, optional

Metadata to store alongside the rows.

Dependency compatibility#

Validate models against the actual production runtime before submission.

production_configuration.compatibility.prepare_jobs(jobs, args, options)[source]#

Reject incompatible models before submitting a production grid.

production_configuration.compatibility.preview(args, image=None)[source]#

Check selected models using the target installation’s bundled catalog.

Parameter scans#

Parameter scan grids and NSB/proton bias-curve scan submissions.

A parameter scan expands a production job grid with the cartesian product of scan values. Each scan combination is stored once as a named parameter set in the ECSV metadata (model_parameter_sets); every expanded row references its set via model_parameter_set and carries the combination name in scan_label.

Bias curves use two scans (NSB and proton), each with a production grid, a scan configuration, and the expanded scan grid. The NSB overwrite sets min_photons and min_photoelectrons to zero; both curves set nsb_scaling_factor.

production_configuration.parameter_scans.expand_job_grid_with_scan(base_grid_file, scan_config_path, output_file)[source]#

Expand a production job grid with parameter scan combinations.

Parameters:
base_grid_filestr or Path

Base job grid file (ECSV format).

scan_config_pathstr or Path

Parameter scan configuration file (YAML format).

output_filestr or Path

Output file for the expanded grid.

production_configuration.parameter_scans.generate_scan_grids(args, io_handler, context=None)[source]#

Generate the NSB and proton bias-curve scan grids.

Parameters:
argsdict

Application arguments for the production grid and scan configuration.

io_handlerOutputPaths

Output paths providing the output directories.

contextRunContext, optional

Run context for model access.