Skip to content

neptoon.quality_control

quality_assessment

Classes:

Functions:

DateTimeIndexValidator

DateTimeIndexValidator(data_frame)

Validator class which checks that the supplied data frame has a datetime index

Init

Parameters:

Name Type Description Default
data_frame DataFrame

DataFrame to be checked

required

ValidationError

Bases: Exception

Custom exception for validation errors.

QualityCheck

QualityCheck(target, method, parameters={})

Creates quality check.

Examples:

Create a quality check that flags neutron intensity values outside the range 500-550:

>>> from neptoon.column_info import ColumnInfo
>>> from neptoon.quality_control import QualityCheck, QAMethod
>>>
>>> check = QualityCheck(
...     target=QATarget.RAW_NEUTRONS,
...     method=QAMethod.RANGE_CHECK,
...     params={
...         "lower_bound": 500,
...         "upper_bound": 550,
...     },
... )

See neptoon.quality_control.WhatParamsDoINeed if you need help on allowable params.

QualityAssessmentFlagBuilder

QualityAssessmentFlagBuilder()

Staging place for the checks as they are built. First a user adds a check using the add_check method.

DataQualityAssessor

DataQualityAssessor(data_frame, saqc_scheme='simple', saqc=None)

Base class for working with SaQC in neptoon. It handles creating the object and checks that the data going in has a datetime index (essential for working in SaQC).

Parameters:

Name Type Description Default
data_frame DataFrame

DataFrame containing time series data.

required

change_saqc_scheme

change_saqc_scheme(scheme)

Changes the saqc_scheme for SaQC object.

Parameters:

Name Type Description Default
scheme str

String representing the scheme for flags. Can be: - simple - float - dmp - positional - annotated-float

see https://rdm-software.pages.ufz.de/saqc/index.html

required

apply_quality_assessment

apply_quality_assessment()

Cycles through the quality checks in the builder applying each of them to the data frame

add_custom_flag_builder

add_custom_flag_builder(builder)

Add a custom built flag builder to the object.

Parameters:

Name Type Description Default
builder QualityAssessmentFlagBuilder

A flag builder - presumed to be pre-constructed

required

add_quality_check

add_quality_check(check)

Can be a check or a list of checks to the internal QualitCheckBuilder

Parameters:

Name Type Description Default
check QualityCheck | List of QualityCheck

Quality checks

required

import_checks_from_config

import_checks_from_config(config)

Here could be a function for building the quality checks from a supplied config file

return_data_frame

return_data_frame()

Returns the timeseries DataFrame.

Returns:

Type Description
DataFrame

The main DataFrame

return_flags_data_frame

return_flags_data_frame(current_flag_data_frame=None)

Returns the flag dataframe

Returns:

Type Description
DataFrame

The DataFrame with assigned flags