QC_derivative, MEG_channel classes

Classes QC_derivative, MEG_channel used in calculation and plotting parts of MEGqc.

class meg_qc.calculation.objects.MEG_channel(name: str, type: str, lobe: str | None = None, lobe_color: str | None = None, system: str | None = None, loc: List | None = None, time_series: List | ndarray | None = None, std_overall: float | None = None, std_epoch: List | ndarray | None = None, ptp_overall: float | None = None, ptp_epoch: List | ndarray | None = None, psd: List | ndarray | None = None, freq: List | ndarray | None = None, mean_ecg: List | ndarray | None = None, mean_ecg_smoothed: List | ndarray | None = None, mean_eog: List | ndarray | None = None, mean_eog_smoothed: List | ndarray | None = None, ecg_time=None, eog_time=None, ecg_corr_coeff=None, ecg_pval=None, ecg_amplitude_ratio=None, ecg_similarity_score=None, eog_corr_coeff=None, eog_pval=None, eog_amplitude_ratio=None, eog_similarity_score=None, muscle=None, head=None, muscle_time=None, head_time=None)[source]

Channel with calculated data, used also for plotting.

add_ecg_info(Avg_artif_list: List, artif_time_vector: List)[source]

Adds ECG artifact info to the channel object.

Parameters:
  • Avg_artif_list (List) – List of the average artifact objects.

  • artif_time_vector (List) – Time vector of the artifact.

add_eog_info(Avg_artif_list: List, artif_time_vector: List)[source]

Adds EOG artifact info to the channel object.

Parameters:
  • Avg_artif_list (List) – List of the average artifact objects.

  • artif_time_vector (List) – Time vector of the artifact.

to_df()[source]

Returns the object as a pandas DataFrame. To be later exported into a tsv file.

class meg_qc.calculation.objects.QC_derivative(content, name: str, content_type: str, description_for_user: str = '', fig_order: float = 0)[source]

Derivative of a QC measurement, main content of which is figure, data frame (saved later as csv) or html string.

content

The main content of the derivative.

Type:

figure, pd.DataFrame or str

name

The name of the derivative (used to save in to file system)

Type:

str

content_type

The type of the content: ‘plotly’, ‘matplotlib’, ‘csv’, ‘report’ or ‘mne_report’. Used to choose the right way to save the derivative in main function.

Type:

str

description_for_user

The description of the derivative, by default ‘Add measurement description for a user…’ Used in the report to describe the derivative.

Type:

str, optional

convert_fig_to_html()[source]

Converts figure to html string.

Returns:

html – Html string or None if content_type is not ‘plotly’ or ‘matplotlib’.

Return type:

str or None

convert_fig_to_html_add_description()[source]

Converts figure to html string and adds description.

Returns:

html – Html string: fig + description or None + description if content_type is not ‘plotly’ or ‘matplotlib’.

Return type:

str or None