libvhc – Definitions

The VCheck object

class libvhc.VCheck(recipe='', check='')[source]

Store the information about the current check.

The attributes can be accessed in the standard way, e.g. instance.attribute, or as in a dictionary, e.g. instance["attribute"].

Parameters:
recipe : string

name of the recipe

check : string

name of the check

Examples

>>> recipe = "flat"
>>> checks = ["common:n_pixels", "common:saturation"]
>>> vcheck = VCheck(recipe)
>>> for c in checks:
...     vcheck.check = c
...     # call the correct check function
...     print(vcheck)
recipe: flat, check: common:n_pixels
recipe: flat, check: common:saturation
>>> print(vcheck.recipe)
flat
>>> print(vcheck["recipe"])
flat
>>> print(vcheck.check)
common:saturation
>>> print(vcheck["check"])
common:saturation
>>> for k in vcheck:
...     print(k, vcheck[k])
recipe flat
check common:saturation
>>> repr(vcheck)
"VCheck('flat', 'common:saturation')"
>>> vcheck['attribute']
Traceback (most recent call last):
    ...
KeyError: attribute is not a valid key
>>> # you can also change the recipe name
>>> vcheck.recipe = 'new_recipe'