autowisp.diagnostics.diagnostic_types module
Class Inheritance Diagram

The catalogue of per-image diagnostics AutoWISP defines.
The vocabulary of diagnostic names, kept apart from the database that stores values against them. Two quite different things want it:
autowisp.database.initialize_database._init_diagnostic_types()seeds a new project’sdiagnostic_typetable from it, which is why the descriptions live here too rather than only the names.autowisp.diagnostics.expressions.check_expression()needs to know what a name in an expression may mean – and needs to know it without a project, since a diagnostic expression is defined once and used in every project.
That second caller is the reason this module exists. The catalogue is a static list: whatever seeds one project seeds them all, so requiring an open database to discover it was a false dependency. The database module is now a consumer of the vocabulary rather than its owner.
The one thing genuinely not knowable in advance is the pixel_q*
family, created at run time by calibrate rather than seeded. Those
are a pattern rather than a list, and no amount of enumeration would
have captured them – hence is_quantile_diagnostic(), which both
the code creating those rows and the code validating expressions against
them ask, so the two cannot drift apart.
Everything here is exposed as a cached function returning an immutable value rather than as a module-level constant, so that a caller cannot mutate the catalogue out from under every other caller in the process.
- autowisp.diagnostics.diagnostic_types._quantile_pattern = re.compile('pixel_q\\d+\\Z')
The one diagnostic family created at run time rather than seeded.
calibraterecords one per configured quantile, so which exist depends on how a project was configured and cannot be listed ahead of time. Digits are required and the match anchored, sopixel_q999is recognised while a plausible future diagnostic such aspixel_qualityis not swallowed.
- autowisp.diagnostics.diagnostic_types.is_diagnostic(name)[source]
Whether name is a diagnostic AutoWISP can record, in any project.
The complete vocabulary, and knowable without opening a database: a
diagnostic_typerow can only come fromstandard_diagnostic_types()at project creation or from the quantile branch ofImageProcessingManager._save_image_diagnostics, which refuses every other name. So no project can hold a diagnostic this does not recognise, and validating an expression needs no project.This is not the question of whether anything has been recorded here, which is per-project and answered by counting rows.
- autowisp.diagnostics.diagnostic_types.is_known_quantity(name)[source]
Whether name resolves to data an expression may read.
The whole readable vocabulary: every diagnostic, plus the time. This is what tier 1 checks a referenced name against.
- autowisp.diagnostics.diagnostic_types.is_quantile_diagnostic(name)[source]
Whether name is one of the run-time quantile diagnostics.
The single definition of what a quantile diagnostic is called. Both the code that creates the rows and the code that validates expressions against them ask here, so the two cannot drift into disagreeing.
- autowisp.diagnostics.diagnostic_types.is_reserved_name(name)[source]
Whether something already answers to name, so an expression may not.
Wider than
is_known_quantity()by exactly one entry, and the asymmetry is the point:quantiles_quantitycannot be read by an expression, since it stands for a family rather than for values, but neither may it be shadowed by one. Expressions, diagnostics and the family name share one flat name space – it is what lets a selector and a URL treat them alike – so a name meaning one thing to the selector and another inside an expression would be ambiguous in both.
- autowisp.diagnostics.diagnostic_types.quantiles_quantity = 'pixel_quantiles'
The pseudo-quantity offered in place of the individual quantiles, which expands to one plotted series per
pixel_q*rather than standing for values of its own. Deliberately spelled without digits, so that it does not matchis_quantile_diagnostic()– it names the family, and is never one of its members.
- autowisp.diagnostics.diagnostic_types.standard_diagnostic_names()[source]
Return just the names, which is all validating an expression needs.
- Returns:
The seeded diagnostic names.
- Return type:
- autowisp.diagnostics.diagnostic_types.standard_diagnostic_types()[source]
Return every diagnostic seeded into a new project.
A mapping rather than a sequence of pairs because that is what the table is:
DiagnosticType.nameis unique, so pairs would admit duplicates that only fail later, at insert time.- Returns:
- Diagnostic name to its description. Read-only,
so it is safe to hand the same object to every caller.
- Return type:
MappingProxyType
- autowisp.diagnostics.diagnostic_types.time_quantity = 'jd'
The name
Image.jdis plotted and referenced under. Not a diagnostic – it is a column of the image row rather than animage_diagnosticsvalue – but it is a variable in the same flat name space, and the only one that is never NaN, since the canonical image list is defined byjd IS NOT NULL. Lives here rather than inexpression_seriesso that validating an expression needs nothing from the database tier.