Skip to content

Restructure src/ using namespaces and add setup script #6

@dcajal

Description

@dcajal

Description:

To improve modularity, avoid naming collisions, and enable clean usage, we will reorganize the library into a namespace using MATLAB’s +folder convention.

New folder structure:

src/
└── +biosigmat/
    ├── +ecg/
    ├── +ppg/
    ├── +tools/

Why use namespaces:

  • Prevents name conflicts with other functions or toolboxes.
  • Allows scoped imports like import biosigmat.ppg.*.
  • Improves autocompletion and structure within MATLAB IDE.
  • Cleaner API and easier maintainability.

User workflow (to be included in the README):

% Step 1: Add the namespace root to the path
addpath('path/to/biosigmat/src/+biosigmat')

% Step 2 (optional): Import specific modules
import biosigmat.ecg.*

Setup automation:

We will provide a biosigmat_setup.m script in the root folder that:

  • Automatically adds src/+biosigmat to the MATLAB path.
  • Can be added to the user’s startup.m for permanent use.

Example script:

function biosigmat_setup()
    src_path = fullfile(fileparts(mfilename('fullpath')), 'src', '+biosigmat');
    fprintf('biosigmat loaded from: %s\n', src_path);
end

Tasks:

  • Rename folders inside src/ to +ecg, +ppg, +tools, etc.
  • Wrap all of them under a +biosigmat/ namespace.
  • Update internal function calls if path-dependent.
  • Add biosigmat_setup.m to the root of the repo.
  • Update README to include setup instructions and optional use in startup.m:
% In startup.m
run('path/to/biosigmat/biosigmat_setup.m');

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions