You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement usage of numeric vectors as input for wl.eval() #287
Up to now, wl.eval expects as input already an hyperSpec object, using its wavelength axis to apply a function given in expression to it resulting in an hyperSpec object with the same wavelength axis as in the original hyperSpec object and values in spc column derived from applied function results.
Another intended use may be, that there is no initial hyperSpec object available, where the wavelength axis can be derived from (e.g. simulation of spectra from scratch). Here, it would be benefical to be able to use a numeric vector of wavelengths as input instead of a full hyperSpec object. The returned structure should be the same as now being a hyperSpec object, but now using the supplied numeric vector as wavelength slot for the newly generated hyperSpec object.
@galaxismad again I would ask you to provide a minimal example of code on how the function works now and the way you would like it to work. The results of the two examples should coincide so that we could use them as a reference.
hyperSpec object
1 spectra
2 data columns
36 data points / spectrum
wavelength: lambda/nm [numeric] 404.5828 404.6181 ... 405.8176
data: (1 rows x 3 columns)
spc: I / a.u. [matrix36] 1.958541e-176 1.890618e-176 ... 5.69705e-177
.f: .f [character] exp
So basically, it will not be dependend on a hyperSpec object as input, but also excepts an numeric vector, which than is used as wavelength instead of extracting the wavelength from a hyperSpec object internally. This results in a slightly different hyperSpec object as output, as the new hyperSpec object does not know any columns except for spc and .f (the named function call, as before).
Activity
GegznaV commentedon Dec 21, 2020
@galaxismad again I would ask you to provide a minimal example of code on how the function works now and the way you would like it to work. The results of the two examples should coincide so that we could use them as a reference.
galaxismad commentedon Dec 21, 2020
The functions works now as follows:
What I like to have is something like:
So basically, it will not be dependend on a hyperSpec object as input, but also excepts an numeric vector, which than is used as wavelength instead of extracting the wavelength from a hyperSpec object internally. This results in a slightly different hyperSpec object as output, as the new hyperSpec object does not know any columns except for spc and .f (the named function call, as before).
GegznaV commentedon Dec 21, 2020
As I understand, the following code can do what @galaxismad expects:
Should we enhance
wl.eval()to have this functionality, @cbeleites?cbeleites commentedon Dec 21, 2020
Yes @GegznaV, I think this would be a good functionality to have. And as you say, it isn't difficult to implement.
GegznaV commentedon Dec 22, 2020
Please, check my implementation in #295