Skip to content

Spectrodataset link rework#334

Merged
Gautzilla merged 6 commits intoProject-OSmOSE:mainfrom
Gautzilla:spectrodataset-link
Feb 4, 2026
Merged

Spectrodataset link rework#334
Gautzilla merged 6 commits intoProject-OSmOSE:mainfrom
Gautzilla:spectrodataset-link

Conversation

@Gautzilla
Copy link
Contributor

@Gautzilla Gautzilla commented Feb 2, 2026

I reworked the SpectroDataset.link_audio_dataset() method so that it now works if the AudioDataset contains more data than the SpectroDataset (providing all SpectroData of the sds can still be effectively linked to an AudioData of the ads):

ads = AudioDataset(...)
ads2 = AudioDataset(...) # Same parameters as ads
ads2.data = [ad for ad in ads2.data[:-1] # But shorter than ads

sds = SpectroDataset.from_audio_dataset(
    audio_dataset=ads2,
    ...
)

sds.link_audio_dataset(audio_dataset=ads)

This last line raised an exception before as len(ads.data] != len(sds.data).

With this PR, the link will be done effectively as long as all spectro data have corresponding audio data in the ads to be linked.

Related issue

This PR resolves #333

@Gautzilla Gautzilla requested a review from mathieudpnt February 2, 2026 15:08
@Gautzilla Gautzilla self-assigned this Feb 2, 2026
@Gautzilla Gautzilla merged commit 6e12859 into Project-OSmOSE:main Feb 4, 2026
1 check passed
@Gautzilla Gautzilla deleted the spectrodataset-link branch February 4, 2026 15: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.

SpectroDataset should be linkable to a larger AudioDataset

2 participants