Skip to content

Grid Association

The Grid Association dialog allows you to combine multiple electrode grids into a single virtual grid while maintaining the relationship between channels and their respective source files.

Overview

In this step, you can: 1. Select grids from different files to combine 2. Name your grid association 3. Save multiple associations in one session 4. Review your saved associations

Grid Association Dialog

Interface Components

Available Grids List

  • Displays all grids from loaded files
  • Shows grid dimensions and reference channel count
  • Format: [rows]x[cols] Grid ([ref_count] refs) - [filename]

Selected Grids List

  • Shows grids selected for combination
  • Supports drag and drop for reordering
  • Order matters for channel mapping

Control Buttons

  • >> button to add a grid to the selection
  • << button to remove a grid from selection
  • + button to save current association and create another
  • Save & Close button to save and exit

Association Name

  • Input field for naming your grid combination
  • Names are sanitized for file system compatibility
  • Timestamp is automatically added to prevent overwrites

Validation Checks

The system performs several automatic checks:

  1. Time Vector Compatibility
  2. Ensures all selected grids have matching time vectors
  3. Prevents combining recordings of different lengths

  4. Sampling Frequency

  5. Verifies all grids have the same sampling frequency
  6. Essential for maintaining signal timing integrity

Data Processing

Channel Combination Process

  1. Grid Size Calculation
  2. Automatically determines optimal dimensions for the combined grid
  3. Uses total EMG channel count to compute rows and columns
  4. Aims for most square-like configuration

  5. Data Integration

  6. Combines EMG channels from all selected grids
  7. Preserves reference signals from each source
  8. Maintains channel descriptions with updated grid dimensions

Metadata Handling

The association is saved in two formats:

  1. MAT File
  2. Contains the combined signal data
  3. Includes updated channel descriptions
  4. Preserves timing and sampling information
  5. Stores grid configuration metadata

  6. JSON File

  7. Records association metadata
  8. Stores original grid information
  9. Contains file references and channel mappings
  10. Includes timestamp and association name

Output Format

Combined Grid MATLAB Data File (MAT)

The newly created .mat file will contain only one, combined grid. The structure will be the same as the original file stucture.

Combined Grid Information (JSON)

{
    "association_name": "your_association_name",
    "timestamp": "YYYY-MM-DD_HH-MM-SS",
    "grids": [
        {
            "file_name": "original_file.mat",
            "rows": 8,
            "cols": 8,
            "emg_count": 64,
            "ref_count": 2,
            "ied_mm": 10,
            "electrodes": {...}
        }
    ],
    "combined_grid_info": {
        "combined_emg_grid": {
            "rows": 16,
            "cols": 8
        },
        "reference_signals": [...]
    }
}

After completing this step, these files will be saved in the associated_grids/ folder within your working directory.

Best Practices

  1. Grid Selection
  2. Ensure grids are from compatible recording sessions
  3. Verify sampling rates match before combining
  4. Consider the spatial relationship between grids

  5. Association Naming

  6. Use descriptive names for easy identification
  7. Include relevant experimental conditions
  8. Names will be sanitized automatically

  9. Data Management

  10. Associations are saved in the workspace
  11. Both .mat and .json files are generated
  12. Original files remain unchanged

Troubleshooting

Common Issues

  1. Validation Errors
  2. Check sampling frequencies match
  3. Verify recording lengths are identical
  4. Ensure all files are from the same experiment

  5. Saving Problems

  6. Verify association name is provided
  7. Check workspace has write permissions
  8. Ensure enough disk space is available

  9. Grid Size Issues

  10. Total channel count must be factorizable
  11. System will optimize grid dimensions automatically
  12. Consider recording setup when selecting grids

Error Messages

  • "Time vectors mismatch between selected grids"
  • Recordings have different lengths
  • Ensure all recordings cover the same time period

  • "Sampling frequency mismatch between selected grids"

  • Different sampling rates detected
  • All grids must have identical sampling frequency