Partial insert into DataArray #3146
Unanswered
TheFermiSea
asked this question in
How can I ... ?
Replies: 1 comment
-
Hi @TheFermiSea, thanks for the kind an encouraging words! I am not entirely sure I understand your question correctly, but it seems you are asking about something related to label-based indexing? As a basic example, you can do: import scipp as sc
da = sc.DataArray(
sc.empty(dims=['x', 'y'], shape=[100, 4]),
coords={'x': sc.arange('x', 100, unit='m')},
)
spec = sc.array(dims=['y'], values=[1.0, 4, 3, 2])
da['x', 4 * sc.Unit('m')] = spec However, you ask about overlapping subsets of wavelengths, which leads me to believe that this might not work for you? Scipp's label-based indexing only supports monotonous coordinates with unique values. Can you give a more detailed example of what you are trying to achieve? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
Let me start by saying how impressed I am with this library. I have been using Xarray for a long time, and Scipp is a significant improvement. There are a few things that I can do in Xarray that I cannot do in Scipp, but the speed improvement is worth the switch.
Here is my most recent issue. I have a 4-dimensional data array that I have initialized with zeroes. One of the dimensions ('EmissionWavelength') is the concatenation of all wavelengths that the spectrometer (multichannel) will eventually encounter (collected by measuring a background at each grating position that will be visited), stored as a scipp.Variable. However, when a single spectrum is collected, the wavelength coordinate is a subset of the larger coordinate. A subsequent grating position would yield a different unique subset of wavelength values that overlaps the previous but contains all unique wavelength values. Can I insert a single spectrum into the larger DataArray in a parallel manner? In Xarray, I can slice a DataArray based on a different array of coordinate values; can I do something similar in Scipp?
Best regards,
TheFermiSea
Beta Was this translation helpful? Give feedback.
All reactions