Skip to content

Same data name error#345

Merged
Gautzilla merged 8 commits intoProject-OSmOSE:mainfrom
Gautzilla:same_data_name_error
Mar 17, 2026
Merged

Same data name error#345
Gautzilla merged 8 commits intoProject-OSmOSE:mainfrom
Gautzilla:same_data_name_error

Conversation

@Gautzilla
Copy link
Contributor

@Gautzilla Gautzilla commented Mar 10, 2026

BonjourBbfbonjourGIF

🐳 What's uuuuup?

This PR adds an error raising if a core API dataset contains data with duplicate names and:

  • The dataset is converted to a dictionary (which data names are keys)
  • The dataset is exported (through BaseDataset.write() or specific methods such as SpectroDataset.save_spectrogram())

🐬 Before

Depending on the context, you could either have missing exports or unclear raised errors.
e.g. when running an AnalysisType.AUDIO|AnaysisType.SPECTROGRAM analysis in a manner where the analysis AudioDataset would contain duplicate names, some data would be missing from the exported json, and the following error would raise later on when trying to link the SpectroDataset:

ValueError: all the input array dimensions except for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 1 and the array at index 2 has size 0

🐬 After

With the modifications from this PR, a more explicit error is raised sooner (when the AudioDataset.write_json() method is called):

ValueError: Duplicate data names found in the nooooooice_audio AudioDataset.
Consider renaming the following data which names appear more than once to avoid errors or missing exports:
230405_155004
230405_155016
230405_155003
230405_15504
230405_154935

Allowing the user to rename the data and rerun the analysis/export/whatever

🐠 TODODIDO

I still have to work on the tests for this PR to be reviewed but I'm on it!

@Gautzilla Gautzilla requested review from mathieudpnt and naiscd March 10, 2026 14:45
@Gautzilla Gautzilla self-assigned this Mar 10, 2026
@coveralls
Copy link
Collaborator

coveralls commented Mar 10, 2026

Coverage Status

coverage: 98.796% (+0.008%) from 98.788%
when pulling 7fe5ec2 on Gautzilla:same_data_name_error
into ba23648 on Project-OSmOSE:main.

@Gautzilla
Copy link
Contributor Author

Coverage Status

coverage: 98.788% (+0.005%) from 98.783% when pulling 3c79365 on Gautzilla:same_data_name_error into 77b34ce on Project-OSmOSE:main.

I know chief, I still have to write a quick test that check that the method is called when calling SpectroDataset.save_spectrogram() and SpectroDataset.save_all().

@Gautzilla Gautzilla changed the title [DRAFT] Same data name error Same data name error Mar 16, 2026
@Gautzilla Gautzilla marked this pull request as ready for review March 16, 2026 15:20
@Gautzilla Gautzilla merged commit 80e88b1 into Project-OSmOSE:main Mar 17, 2026
1 check passed
@Gautzilla Gautzilla deleted the same_data_name_error branch March 17, 2026 16:57
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

Successfully merging this pull request may close these issues.

3 participants