API Reference
Settings
GravityToolsNext.RunPaths — Type
RunPathsHolds paths for a TEMPO run.
Fields
work_dir::String: Absolute working directory for the runpar_input::String: Input.parfile name or relative path (resolved againstwork_dir; absolute paths are rejected)par_output::String: Output.parfile name (filename only; no directories)tim_input::String:.timfile name or relative path (resolved againstwork_dir; absolute paths are rejected)
Notes
- A keyword constructor
RunPaths(; work_dir, par_input, tim_input, par_output=default_par_output(par_input))is available.
GravityToolsNext.default_par_output — Function
default_par_output(par_input::AbstractString) -> StringGenerate a default output file name (no directories) by taking basename(par_input) and replacing its .par extension with *_out.par.
- Accepts either a bare filename or any path.
- Still enforces that the basename ends with
.par(case‑insensitive).
GravityToolsNext.EngineOptions — Type
EngineOptionsDefines low-level options for a TEMPO run.
Fields
tempo_version::AbstractTempoVersion: Which TEMPO flavor to useflags::String: Additional command-line flags (normalized string)nits::Int: Number of internal iterations (must be ≥ 1)gain::Float64: GAIN parameter controlling convergence damping (must be > 0)
Notes
flagsshould be a single string; it is normalized (trimmed) and must not contain newlines.gainis validated to be strictly positive.
GravityToolsNext.InputModifiers — Type
InputModifiersDescribes transformations applied to the inputs of a TEMPO run.
Fields
override_params::Vector{TempoParameter}: parameters to upsert into the.partime_start::Union{Nothing,Float64}: optional lower MJD bound (inclusive)time_finish::Union{Nothing,Float64}: optional upper MJD bound (inclusive)couple_f1_to_ddot::Bool: if true, auto-adjustF1whenDDOTis overridden (applied during materialization)
Notes
- If both
time_startandtime_finishare provided,time_start ≤ time_finishis enforced.
GravityToolsNext.CaptureOptions — Type
CaptureOptionsControls what is captured/emitted by the TEMPO engine itself (flags / process I/O).
Fields
write_output::Bool: capture stdout/stderr from the enginewrite_residuals::Bool: for Tempo2 uses-write_residuals(per internal iteration); for Tempo uses-residuals(final only)
GravityToolsNext.RetentionOptions — Type
RetentionOptionsControls what data we keep in the in-memory/result structures after a run.
Fields
save_internal_iterations::Bool: retain all intermediate iteration resultssave_residuals::Bool: retain residuals arrays inside results (can be large)
GravityToolsNext.WhiteNoiseOptions — Type
WhiteNoiseOptions(; enabled=false, scope=:final)Options for white-noise analysis:
enabled— toggle analysis;scope—:final(last internal iteration) or:all(every internal iteration).
GravityToolsNext.WorkspaceOptions — Type
WorkspaceOptionsWorkspace/runtime controls for a single TEMPO run. The options are grouped by intent:
Lifecycle & isolation
work_mode::Symbol::inplace|:jobdir:inplace— run directly insidework_dir(job root =work_dir).:jobdir— create/use a subdirectory ofwork_diras an isolated job root.
job_name::Union{Nothing,String}: subdirectory name whenwork_mode=:jobdir.- If
nothing, an auto name likejob-YYYYmmdd-HHMMSS-<rand>is generated.
- If
overwrite::Symbol::error|:reuse|:unique|:clean- Behavior when the target job directory already exists (
:uniqueappends-001,-002, ...). :error— fail if exists;:reuse— use as-is;:clean— purge contents then use.:overwriteis accepted for backward compatibility and treated as:clean(a warning is emitted).
- Behavior when the target job directory already exists (
Layout of files (inside the job root)
layout::Symbol::flat|:split:flat— files live directly in the job root.:split— createinput/,output/,tmp/under the job root.
temp_dir::Union{Nothing,String}- If
nothing, the executioncwdis the job root for:flat, ortmp/for:split. - If non-
nothing, use this subdirectory as the executioncwd(created if missing).
- If
I/O mirroring
io_mirror::Union{Symbol,Int,Tuple{Symbol,Int}} = :none- Controls how the
temp_dir(or job root) directory structure is mirrored for I/O. :none(flat),:full(mirror fulltemp_dir),Int(first N segments),(:depth_minus, k)(first depth-k segments).- Ignored when
layout = :flat.
- Controls how the
Inputs capture into job root
link_tim::Bool: symlink the.timfile instead of copying (falls back to copy if symlink fails).snapshot_par::Bool: copy the input.parfor reproducibility.
Cleanup & retention
cleanup_before_run::Bool: remove engine artifacts in the run directory before launch.keep_tmp_on_success::Bool: keeptmp/after a successful run (useful for debugging).keep_tmp_on_error::Bool: keeptmp/if the run failed.
Runtime & manifest
timeout_s::Union{Nothing,Int}: kill the run after this many seconds (nothing= unlimited).write_manifest::Bool: write a small manifest file in the job root.manifest_style::Symbol::json|:toml.
GravityToolsNext.LoggingOptions — Type
LoggingOptionsLightweight logging verbosity controls for the runner.
verbosity— one of:silent | :warn | :info | :debug(also accepts0..3in the constructor)with_timestamps— include timestamps in log lines
GravityToolsNext.TempoRunSettings — Type
TempoRunSettingsTop-level settings for a single TEMPO run. Composed from smaller structures:
paths::RunPathsengine::EngineOptionsmodifiers::InputModifierscapture::CaptureOptionsretention::RetentionOptionsanalysis::WhiteNoiseOptionsworkspace::WorkspaceOptionslogging::LoggingOptions
GravityToolsNext.copy_with — Function
copy_with(s::TempoRunSettings; kwargs...) -> TempoRunSettingsCreate a modified copy of s with keyword overrides. You can override either whole sub-structs (analysis, workspace, logging) or individual convenience keys (e.g. white_noise_enabled, timeout_s, verbosity, ...).
Additional override-params controls:
override_params_clear::Bool=false: start from an empty override list.override_params_delete: names (Symbol/String or a collection of them) to remove from overrides.override_params_upsert::Vector{TempoParameter}=TP[]: add/replace overrides by name.
If override_params is provided, delete/upsert are applied on top of it.
copy_with(e::PriorExecutionOptions; kwargs...) -> PriorExecutionOptionsReturn a copy of e with any provided keyword overrides applied. Valid keys:
mode,chain_direction,chain_snapshot_parscheduler,max_workersworkdir_layout,node_dir_prefix,keep_node_dirson_errordir_name_mode,index_pad,value_sig
copy_with(s::PriorMarginalizationSettings; kwargs...) -> PriorMarginalizationSettingsCreate a modified copy of s, overriding any subset of fields via keyword arguments. All validations are performed by the regular constructor.
Keyword arguments mirror the settings fields:
parameter,pin_mode,prior,nodeslikelihood_source,ref_strategy,ref_valuerepresentative,save_node_resultsexec_options,metrics_hook,seed_spec
GravityToolsNext.validate — Function
validate(v::AbstractTempoVersion) -> BoolCheck that data directory exists and the executable is available (or at least named). Returns true if OK, otherwise throws.
validate(s::TempoRunSettings) -> BoolAlias for [validate_inputs_exist] — quick pre-materialization check that input .par/.tim exist relative to work_dir and that par_output is a bare file name. Does not create directories.
Runner & Tasks
GravityToolsNext.run_tempo_parsed — Function
run_tempo_parsed(settings::TempoRunSettings) :: TempoRunOutputMaterialize the workspace, run TEMPO/TEMPO2 with relative paths, parse stdout into iteration records, and assemble RunArtifacts. No post-run deletion is performed here; call cleanup_run! from task-level code after reading the artifacts.
GravityToolsNext.BasicTempoTask — Type
BasicTempoTask(settings::TempoRunSettings)Single TEMPO/TEMPO2 task with parsed iterations, optional residual statistics, and optional white-noise analysis controlled by settings.analysis.
GravityToolsNext.run_task — Function
run_task(task::SingleTempoTask) -> GeneralTempoResultExecute the task and return a unified result. Every concrete SingleTempoTask must provide a method.
run_task(task::MultiPointTask)Entry point for multi-point workflows. Define as needed for your project.
run_task(task::BasicTempoTask) -> GeneralTempoResultRun TEMPO/TEMPO2 using task.settings, parse iteration-wise outputs, attach residual/TIM-derived statistics, optionally perform white-noise fitting, and return an aggregated GeneralTempoResult.
run_task(task::PriorMarginalizedTempoTask) -> GeneralTempoResultExecute the prior-marginalized task: build θ grid, run/supply node results, and assemble the aggregated GeneralTempoResult.
If settings.exec_options.on_error == :stop, the execution stops at the first failing node (detected by _check_nodes_for_error) and returns that node's GeneralTempoResult annotated by _bad_prior_result with :prior_mode => :stopped_on_error.
GravityToolsNext.task_stage_inputs! — Function
task_stage_inputs!(task::SingleTempoTask, dest_dir::AbstractString) -> NothingStage/copy any task-specific input artifacts into dest_dir so that the task can run there using name-only paths. Default implementation does nothing.
Wrappers like prior-marginalization should call this before cloning a task with a new work_dir.
Adaptive Grid
GravityToolsNext.GridAxis — Type
GridAxis(name; min, max, N, rule)
GridAxis(name, values::AbstractVector)A typed grid axis with a chosen discretization rule. Call axisvalues to obtain physical coordinates and linspace to obtain the rule's linear parameterization.
Arguments
name::Symbol: semantic axis name (e.g.:PBDOT,:beta0).min, max: axis bounds (ignored forExplicitRule).N::Integer: number of grid points (must be ≥ 1).rule: one ofLinRule(),LogRule([sign]), orExplicitRule.- values : alternative constructor; makes an ExplicitRule from a supplied vector of nodes.
Examples
ax1 = GridAxis(:x; min=-1.0, max=1.0, N=21, rule=LinRule())
ax2 = GridAxis(:m; min=-1e-4, max=-1e-2, N=16, rule=LogRule()) # auto-sign (−)
ax3 = GridAxis(:θ, [-1.0, -0.5, 0.0, 0.5, 1.0]) # explicit nodesGravityToolsNext.LinAxis — Type
GridAxis(name; min, max, N, rule)
GridAxis(name, values::AbstractVector)A typed grid axis with a chosen discretization rule. Call axisvalues to obtain physical coordinates and linspace to obtain the rule's linear parameterization.
Arguments
name::Symbol: semantic axis name (e.g.:PBDOT,:beta0).min, max: axis bounds (ignored forExplicitRule).N::Integer: number of grid points (must be ≥ 1).rule: one ofLinRule(),LogRule([sign]), orExplicitRule.- values : alternative constructor; makes an ExplicitRule from a supplied vector of nodes.
Examples
ax1 = GridAxis(:x; min=-1.0, max=1.0, N=21, rule=LinRule())
ax2 = GridAxis(:m; min=-1e-4, max=-1e-2, N=16, rule=LogRule()) # auto-sign (−)
ax3 = GridAxis(:θ, [-1.0, -0.5, 0.0, 0.5, 1.0]) # explicit nodesGravityToolsNext.LogAxis — Type
GridAxis(name; min, max, N, rule)
GridAxis(name, values::AbstractVector)A typed grid axis with a chosen discretization rule. Call axisvalues to obtain physical coordinates and linspace to obtain the rule's linear parameterization.
Arguments
name::Symbol: semantic axis name (e.g.:PBDOT,:beta0).min, max: axis bounds (ignored forExplicitRule).N::Integer: number of grid points (must be ≥ 1).rule: one ofLinRule(),LogRule([sign]), orExplicitRule.- values : alternative constructor; makes an ExplicitRule from a supplied vector of nodes.
Examples
ax1 = GridAxis(:x; min=-1.0, max=1.0, N=21, rule=LinRule())
ax2 = GridAxis(:m; min=-1e-4, max=-1e-2, N=16, rule=LogRule()) # auto-sign (−)
ax3 = GridAxis(:θ, [-1.0, -0.5, 0.0, 0.5, 1.0]) # explicit nodesGravityToolsNext.ExplicitAxis — Type
GridAxis(name; min, max, N, rule)
GridAxis(name, values::AbstractVector)A typed grid axis with a chosen discretization rule. Call axisvalues to obtain physical coordinates and linspace to obtain the rule's linear parameterization.
Arguments
name::Symbol: semantic axis name (e.g.:PBDOT,:beta0).min, max: axis bounds (ignored forExplicitRule).N::Integer: number of grid points (must be ≥ 1).rule: one ofLinRule(),LogRule([sign]), orExplicitRule.- values : alternative constructor; makes an ExplicitRule from a supplied vector of nodes.
Examples
ax1 = GridAxis(:x; min=-1.0, max=1.0, N=21, rule=LinRule())
ax2 = GridAxis(:m; min=-1e-4, max=-1e-2, N=16, rule=LogRule()) # auto-sign (−)
ax3 = GridAxis(:θ, [-1.0, -0.5, 0.0, 0.5, 1.0]) # explicit nodesGravityToolsNext.linspace — Function
linspace(ax)Return the linear parameterization for an axis:
- For
LinAxis, this equals the physical coordinates. - For
LogAxis, this is uniform inlog10(|x|). - For
ExplicitAxis, returns a copy of the stored values.
The result is a copy (safe to mutate by the caller).
GravityToolsNext.axisvalues — Function
axisvalues(ax)Return the physical coordinates for an axis. For LogAxis, uses the rule sign (+1/−1) or infers it from ax.min when the rule is constructed with LogRule().
The result is a copy (safe to mutate by the caller).
GravityToolsNext.RefinementSettings — Type
RefinementSettings(units...; desired_refinement_level, parallel=false, params_to_save=())Container for adaptive‑grid refinement configuration.
Arguments
units...: one or more refinement units (order matters).desired_refinement_level: how many refinement rounds to perform (≥ 0).parallel: whether the grid engine may run points in parallel.params_to_save: tuple of metric names to extract at each point.
GravityToolsNext.LocalMinimaUnit — Type
LocalMinimaUnit(name; min=-Inf, max=Inf, from_min=true)Refine until a local minimum is detected along variable name within the interval [min, max].
Arguments
name::Symbol: the variable/axis identifier.min,max: bounds of the search interval.from_min: iftrue, sweep from the lower bound (otherwise from upper).
GravityToolsNext.FullUnit — Type
FullUnit(name; min=-Inf, max=Inf)Always refine over the whole range [min, max] of variable name.
GravityToolsNext.DiffUnit — Type
DiffUnit(name; min=-Inf, max=Inf, diff, from_min=true)Refine where the absolute change Δ(metric) exceeds diff within [min, max]. If from_min is true, scanning proceeds from the lower bound.
GravityToolsNext.RelDiffUnit — Type
RelDiffUnit(name; min=-Inf, max=Inf, rel_diff, from_min=true)Refine where the relative change exceeds rel_diff within [min, max].
GravityToolsNext.ContourUnit — Type
ContourUnit(name; min=-Inf, max=Inf, contours, from_min=true)Refine near specified contour levels (contours) of the target metric within [min, max]. contours can be a number, a tuple, or a vector of levels.
GravityToolsNext.DiffContourUnit — Type
DiffContourUnit(name; min=-Inf, max=Inf, diffs, contours, from_min=true)Refine near combinations of absolute difference thresholds (diffs) and contour levels (contours) within [min, max]. diffs/contours accept a number, tuple, or vector.
GravityToolsNext.AdaptiveRefinement2DGrid — Type
AdaptiveRefinement2DGridStructure representing a 2D adaptive refinement grid with variables, parameters, axes, refinement settings, and refinement status.
GravityToolsNext.GridWorkspaceOptions — Type
GridWorkspaceOptionsWorkspace and tagging options for Adaptive2DGridTask.
Fields
grid_root::String: Root folder for all grid artifacts. If relative, it's resolved against the base taskwork_dir.point_job_prefix::String: Subdirectory undergrid_rootto hold per-point job folders (used as part ofjob_name).results_dirname::String: Subdirectory undergrid_rootwhere per-point results (e.g., JLD2 files) are saved.input_dirname::String: Optional subdirectory name used when staging base inputs for the grid.
Tagging
tag_mode::Symbol::with_valueto embed axis values into the tag,:hashto use a stable hash instead.tag_value_sig::Int: Significant digits when formatting values for:with_valuetags.tag_sep::String: Separator between X and Y parts for:with_valuetags.sanitize::Bool: Make tag filesystem-safe.hash_len::Int: Number of hex characters to keep whentag_mode == :hash.
Persistence & staging
save_results_jld2::Bool: Save fullGeneralTempoResultfor each point intoresults_dirname.stage_inputs::Bool: Stage base task inputs into the grid root once before running.stage_inputs_mode::Symbol: Where to stage inputs::root(intogrid_root) or:subdir(intogrid_root/input_dirname).
GravityToolsNext.Adaptive2DGridTask — Type
Adaptive2DGridTask(; base_task, x, y, ref_settings, opts=GridWorkspaceOptions())Run a SingleTempoTask over an adaptively refined 2D grid defined by axes x and y.
Arguments
base_task::SingleTempoTask: The task to clone and execute at each grid point.x::GridAxis,y::GridAxis: Grid axes (linear/log/explicit rules supported).ref_settings::RefinementSettings: Refinement engine configuration (units and parameters to save).opts::GridWorkspaceOptions: Workspace layout, tagging, and persistence options.
Behavior
- Each grid point is run in its own job directory (under
opts.grid_root) with a uniquejob_nameandpar_outputstem. - The task is cloned via
task_copy_withand parameter overridesTP(string(x.name), xv),TP(string(y.name), yv). - Selected result scalars are returned to the grid engine as a
NamedTuplekeyed byref_settings.params_to_save.
GravityToolsNext.Adaptive2DGridTaskGravityToolsNext.AdaptiveRefinement2DGridGravityToolsNext.BasicTempoTaskGravityToolsNext.CaptureOptionsGravityToolsNext.ContourUnitGravityToolsNext.DiffContourUnitGravityToolsNext.DiffUnitGravityToolsNext.EngineOptionsGravityToolsNext.ExplicitAxisGravityToolsNext.FullUnitGravityToolsNext.GridAxisGravityToolsNext.GridWorkspaceOptionsGravityToolsNext.InputModifiersGravityToolsNext.LinAxisGravityToolsNext.LocalMinimaUnitGravityToolsNext.LogAxisGravityToolsNext.LoggingOptionsGravityToolsNext.RefinementSettingsGravityToolsNext.RelDiffUnitGravityToolsNext.RetentionOptionsGravityToolsNext.RunPathsGravityToolsNext.TempoRunSettingsGravityToolsNext.WhiteNoiseOptionsGravityToolsNext.WorkspaceOptionsGravityToolsNext.axisvaluesGravityToolsNext.copy_withGravityToolsNext.default_par_outputGravityToolsNext.linspaceGravityToolsNext.run_taskGravityToolsNext.run_tempo_parsedGravityToolsNext.task_stage_inputs!GravityToolsNext.validate