Skip to content

ReC

Description

This integration loads raw EMG recordings exported as binary .sig files by ReC/MEACS and ReC/BAM acquisition systems. It also provides a file-selection interface and a loader for channels from ReC GAM auxiliary files.


select_and_load_rec_file(gam_channels=None, ied=None, parent=None)

Select a *_EMG_raw.sig file (and optionally a GAM file) with file dialogs, then load them.

A first dialog selects the *_EMG_raw.sig or *_SIG_raw.sig file. If ied was not already provided, a second dialog then asks for the interelectrode distance (IED), pre-filled with the default (10 mm), so accepting it as-is just keeps the default. A third dialog is then shown to optionally select a GAM auxiliary file, which can be located in a different folder: if it is canceled, no GAM file is used and REF_SIGNAL is unaffected. If a GAM file is selected and gam_channels was not already provided, a fourth dialog asks which channel indices to load from it.

The file is loaded with emg_from_rec(), which automatically detects whether it comes from a ReC/MEACs or a ReC/BAM system based on the system code embedded in the filename, and loads it with the matching loader (emg_from_rec_meacs or emg_from_rec_bam).

PARAMETER DESCRIPTION
gam_channels

Passed to emg_from_rec(). 0-based channel indices to extract from the GAM file. If None and a GAM file is selected in the third dialog, a fourth dialog asks the user to type them instead of raising an error.

TYPE: int or list of int or None DEFAULT: None

ied

Passed to emg_from_rec(). The interelectrode distance, in mm, of the matrix used to acquire the selected file. If None, a second dialog asks for it (pre-filled with the default, 10 mm).

TYPE: float or None DEFAULT: None

parent

Optional Qt parent used when embedding the dialog.

TYPE: QWidget or None DEFAULT: None

RETURNS DESCRIPTION
emgfile

The loaded emgfile, or None if the first dialog (EMG file) was canceled.

TYPE: dict or None

See also
  • emg_from_rec : Generic loader dispatching to emg_from_rec_meacs or emg_from_rec_bam based on the filename.

Examples:

>>> from openhdemg.integrations.rec import select_and_load_rec_file
>>> emgfile = select_and_load_rec_file()


emg_from_rec(filepath, gam_filepath=None, gam_channels=None, ied=10.0)

Generic loader for ReC/MEACS and ReC/BAM .sig files.

The acquisition system that produced filepath is identified from the system code embedded in its filename (the underscore-delimited segment immediately preceding "_EMG_raw" or "_SIG_raw", e.g. "M02CF1" in "Dy14042025_180733_M02CF1_EMG_raw.sig" or "Dy14042025_180733_B01AA01_SIG_raw.sig"). Based on the first letter of that code, the file is loaded with the matching system-specific loader:

"M" -> emg_from_rec_meacs
"B" -> emg_from_rec_bam

Optionally, one or more channels from a GAM auxiliary file can be appended as extra columns of REF_SIGNAL.

PARAMETER DESCRIPTION
filepath

Path to the *_EMG_raw.sig or *_SIG_raw.sig file to load. This is typically the path returned by the file-selection interface in openhdemg.integrations.rec.rec.

TYPE: str or Path

gam_filepath

Optional path to a GAM auxiliaryfile. Its filename carries "G" in the same position as "M"/"B", and it does not end in "_EMG_raw" (e.g. "Dy14042025_180733_G01AA3_AUX_raw.sig"). If None, or if the file does not exist, no GAM data is loaded and REF_SIGNAL is unaffected by this parameter.

TYPE: str or Path or None DEFAULT: None

gam_channels

0-based channel indices to extract from the GAM file and append as extra columns of REF_SIGNAL. Required if gam_filepath is provided and points to an existing file.

TYPE: int or list of int or None DEFAULT: None

ied

The interelectrode distance, in mm, of the matrix used to acquire filepath. Passed through to emg_from_rec_meacs or emg_from_rec_bam.

TYPE: float DEFAULT: 10.0

RETURNS DESCRIPTION
emgfile

The dictionary returned by emg_from_rec_meacs or emg_from_rec_bam (depending on the system identified from filepath), with REF_SIGNAL additionally containing the requested GAM channels as extra columns, if gam_filepath was provided and found.

TYPE: dict

See also
  • emg_from_rec_meacs : Import .sig files from ReC/MEACs systems.
  • emg_from_rec_bam : Import .sig files from ReC/BAM systems.
RAISES DESCRIPTION
ValueError

If the system code cannot be identified from filepath, if it starts with a letter other than "M" or "B", if gam_channels is not provided while gam_filepath points to an existing file, or if a requested GAM channel index is out of range.

Examples:

>>> from openhdemg.integrations.rec import emg_from_rec
>>> emgfile = emg_from_rec(
...     filepath="path/Dy14042025_180733_M02CF1_EMG_raw.sig",
...     gam_filepath="path/Dy14042025_180733_G01AA3_AUX_raw.sig",
...     gam_channels=[4],
...     ied=10.0,
... )


emg_from_rec_meacs(filepath, ied=10.0)

Import the .sig file exportable from ReC/MEACS systems.

PARAMETER DESCRIPTION
filepath

The directory and the name of the file to load (including file extension .sig). This can be a simple string, the use of Path is not necessary.

TYPE: str or Path

ied

The interelectrode distance, in mm, of the matrix used to acquire filepath.

TYPE: float DEFAULT: 10.0

RETURNS DESCRIPTION
emgfile

A dictionary containing all the useful variables. RAW_SIGNAL is expressed in microvolts (µV), centered on 0.

TYPE: dict

RAISES DESCRIPTION
ValueError

If the file is too short to contain even a single full sample across all channels.

Examples:

>>> import openhdemg.library as emg
>>> from openhdemg.integrations.rec import emg_from_rec_meacs
>>> emgfile = emg_from_rec_meacs(filepath="path/filename.sig")
>>> info = emg.info()
>>> info.data(emgfile)


emg_from_rec_bam(filepath, ied=10.0)

Import the .sig file exportable from ReC/BAM systems.

PARAMETER DESCRIPTION
filepath

The directory and the name of the file to load (including file extension .sig). This can be a simple string, the use of Path is not necessary.

TYPE: str or Path

ied

The interelectrode distance, in mm, of the matrix used to acquire filepath.

TYPE: float DEFAULT: 10.0

RETURNS DESCRIPTION
emgfile

A dictionary containing all the useful variables. RAW_SIGNAL is expressed in microvolts (µV), centered on 0.

TYPE: dict

RAISES DESCRIPTION
ValueError

if the file is too short to contain even a single full sample across all channels.

Examples:

>>> import openhdemg.library as emg
>>> from openhdemg.integrations.rec import emg_from_rec_bam
>>> emgfile = emg_from_rec_bam(filepath="path/filename.sig")
>>> info = emg.info()
>>> info.data(emgfile)


aux_from_rec_gam(gam_filepath, gam_channels)

Read one or more channels from a ReC GAM auxiliary file.

PARAMETER DESCRIPTION
gam_filepath

Path to the GAM auxiliary file (its filename carries "G" in the same position as "M"/"B", e.g. "Dy14042025_180733_G01AA3_AUX_raw.sig").

TYPE: str or Path

gam_channels

0-based channel indices to extract from the GAM file.

TYPE: int or list of int

RETURNS DESCRIPTION
gam_df

The requested GAM channels converted to Volts, as columns 0, 1, ... in the same order as gam_channels.

TYPE: DataFrame

See also
  • emg_from_rec : Uses this function to optionally append GAM channels to REF_SIGNAL.
RAISES DESCRIPTION
ValueError

If any index in gam_channels is out of range (the GAM file has a fixed number of 14 channels, 0 to 13).

Examples:

>>> from openhdemg.integrations.rec import aux_from_rec_gam
>>> gam_df = aux_from_rec_gam(
...     gam_filepath="path/Dy14042025_180733_G01AA3_AUX_raw.sig",
...     gam_channels=[4],
... )