Skip to content

Concatenate #733

Answered by atravert
valentinavan asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @valentinavan ,

Thank you for your message. To indentify the individual spectra, you can use the label property, for instance:

all_spectra = scp.concatenate([ds1, ds2], axis='y')
for spectrum_labels in ds1.y.labels:
    print(spectrum_labels)
print('---')
for spectrum_labels in s2.y.labels:
    print(spectrum_labels)
print('---')
for spectrum_labels in all_spectra.y.labels:
    print(lspectrum_labels)

The concatenation preserves the original order of the spectra, i.e. the first spectrum of all_spectra is the first spectrum of ds1 and the last spectrum of all_spectra is the last of ds2.

Note also that the labels attribute is protected, so that:

s1.y.labels = [f"spectrum #{i}" for i in r…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by atravert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants