Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Constructing "container" class with name-value pair where name matches property name does not work #676

Open
2 tasks done
ehennestad opened this issue Mar 5, 2025 · 0 comments

Comments

@ehennestad
Copy link
Collaborator

ehennestad commented Mar 5, 2025

What happened?

Some neurodata types are containers for other neurodata types, for example BehavioralEpochs.

The types.core.BehavioralEpochs class in MatNWB has one property, intervalseries. The value of the intervalseries property should be a types.untyped.Set that can contain one or more types.core.IntervalSeries objects.

The BehavioralEpochs constructor has this line:

[obj.intervalseries, ivarargin] = types.util.parseConstrained(obj,'intervalseries', 'types.core.IntervalSeries', varargin{:});

who is assigning named IntervalSeries objects as members of a set in the intervalseries property.

However, the types.util.parseConstrained will ignore IntervalSeries objects if the name matches the property name (See examples below)

Steps to Reproduce

% First create an IntervalSeries
intervalSeries = types.core.IntervalSeries(...
    'data', ones(10, 1), ... % Example data
    'timestamps', 1:10); % Timestamps

% Create BehavioralEpochs with the IntervalSeries
behavioralEpochs = types.core.BehavioralEpochs(...
    'interval_series', intervalSeries);

Adds the IntervalSeries object to the set:

>> behavioralEpochs

behavioralEpochs = 

  BehavioralEpochs with properties:

    intervalseries: [1×1 types.untyped.Set]

>> 
% First create an IntervalSeries
intervalSeries = types.core.IntervalSeries(...
    'data', ones(10, 1), ... % Example data
    'timestamps', 1:10); % Timestamps

% Create BehavioralEpochs with the IntervalSeries
behavioralEpochs = types.core.BehavioralEpochs(...
    'intervalseries', intervalSeries);

When the name of the input matches the propertyname this produces a set with no elements:

>> behavioralEpochs

behavioralEpochs = 

  BehavioralEpochs with properties:

    intervalseries: [0×1 types.untyped.Set]

Error Message

Operating System

macOS

Matlab Version

R2023b

Code of Conduct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant