IterationOptions

class sofia_redux.scan.configuration.iterations.IterationOptions(allow_error=False, verbose=True, max_iteration=None)[source]

Bases: Options

Initialize the configuration iteration options.

The iteration options store and apply configuration settings for the main reduction configuration that depend on the current reduction iteration. It is also where the maximum number of iterations for the reduction is stored and defined in all cases.

Parameters:
allow_errorbool, optional

If True, allow poorly formatted options to be skipped rather than raising an error.

verbosebool, optional

If True, issues a warning when a poorly option is encountered.

max_iterationint, optional

The maximum number of iterations available for a SOFSCAN reduction.

Attributes Summary

append_keys

max_iteration

Return the maximum number of iterations for the current reduction.

rounds_locked

Return whether the maximum number of iterations is locked.

Methods Summary

clear()

Clear all options.

copy()

Return a copy of the iteration options.

get(iteration[, default, unalias])

Retrieve configuration options for a given date.

lock_rounds([maximum_iterations])

Lock the current maximum number of iterations in-place.

parse_iteration(iteration)

Returns an iteration value as either an int or float value.

relative_iteration(iteration)

Return an iteration number relative to the current maximum.

set(iteration, options)

Set the options for a given iteration.

set_iteration(configuration, iteration[, ...])

Set options for a given iteration in a configuration.

unlock_rounds()

Allow the maximum number of iterations to be changed.

update(configuration_options)

Update the iteration options with settings from another.

Attributes Documentation

append_keys = ('blacklist', 'whitelist', 'forget', 'recall', 'lock', 'unlock', 'add', 'config')
max_iteration

Return the maximum number of iterations for the current reduction.

Returns:
int
rounds_locked

Return whether the maximum number of iterations is locked.

Returns:
bool

Methods Documentation

clear()[source]

Clear all options.

Returns:
None
copy()[source]

Return a copy of the iteration options.

Returns:
IterationOptions
get(iteration, default=None, unalias=True)[source]

Retrieve configuration options for a given date.

Parameters:
iterationstr or int or float

The observation date. If a string is used, it should be in ISOT format in UTC scale. Integers and floats will be parsed as MJD times in the UTC scale.

defaultdict or configobj.ConfigObj, optional

A value to return if no results are found. Must be of dict or configobj.ConfigObj type to be returned.

unaliasbool, optional

Not used by the IterationOptions.

Returns:
optionsConfigObj
lock_rounds(maximum_iterations=None)[source]

Lock the current maximum number of iterations in-place.

Returns:
None
parse_iteration(iteration)[source]

Returns an iteration value as either an int or float value.

Parses string iterations including “first”, “last”, “final” to integer of float representations. Can also parse percentages such as 90%. A float iteration represents a fraction of the maximum iteration, and must therefore be between 0 and 1. Raises an error if fractional iteration is out of range, or value could not be parsed.

Parameters:
iterationstr or int or float
Returns:
iterationint or float

If the return value is a float, it will be between 0 and 1 and represents the fraction of the maximum iterations. Negative integers represent maximum_iteration - iteration.

relative_iteration(iteration)[source]

Return an iteration number relative to the current maximum.

Parameters:
iterationstr or int or float

The iteration number to parse. Please see IterationOptions.parse_iteration() for further details.

Returns:
int or None

None will be returned if an iteration relative to a maximum iteration is required, but no maximum iteration has been set.

set(iteration, options)[source]

Set the options for a given iteration.

Parameters:
iterationstr or int or float

The iteration number or relative iteration number. Please see IterationOptions.parse_iteration() for further details.

optionsdict or configobj.ConfigObj

The options to set for an iteration.

Returns:
None
set_iteration(configuration, iteration, validate=True)[source]

Set options for a given iteration in a configuration.

Parameters:
configurationConfiguration

The configuration in which to apply the iteration options.

iterationint or str or float

The iteration for which to apply options.

validatebool, optional

If True, validate the configuration once the iteration options have been applied.

Returns:
None
unlock_rounds()[source]

Allow the maximum number of iterations to be changed.

Returns:
None
update(configuration_options)[source]

Update the iteration options with settings from another.

Parameters:
configuration_optionsdict or configobj.ConfigObj

The options used to update these options. Must contain an ‘iteration’ key and values to have an effect.

Returns:
None