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
Is your feature request related to a problem? Please describe.
The LinkML expression language has a lot of useful features, but it does not support for loops and list comprehensions. This would be useful when generating lists and arrays.
I would also like range to be supported.
Describe the solution you'd like
For example, I want to define a class for a list of timestamps with a regular interval. It has an array attribute values_in_s that is defined by a starting time, sampling rate, and length. In Python, this would look like timestamp_values = [1 / sampling_rate + start_time for i in range(length)]
Here is a more concrete example
RegularlySampledTimestampSeries:
description: >- A 1D array of timestamps, represented efficiently using a sampling rate, starting time, and number of elements (length).attributes:
sampling_rate_in_Hz:
range: floatrequired: trueunit:
ucum_code: Hzstarting_time_in_s:
range: floatrequired: trueunit:
ucum_code: slength:
range: integerrequired: trueimplements:
- linkml:lengthvalues_in_s:
range: floatrequired: trueunit:
ucum_code: sarray:
exact_number_dimensions: 1# I would like to do the following:equals_expression: "[i / {sampling_rate_in_Hz} + {starting_time_in_s} for i in range({length})]"
This is important for adoption by the NWB team and for any other array cases where you don't want to store a million timestamps that can be simply computed by an equation.
How important is this feature?
• Medium - can do work without it; but it's important (e.g. to save time or for convenience)
When will use cases depending on this become relevant?
• Long-term - 6 months - 1 year
The text was updated successfully, but these errors were encountered:
Here is a more complex 2D case. This case is not necessary to support in LinkML (we can just add this as a convenience function to the API), but it would be nice.
The 1D case above is important because the number of values that are stored go from a million to three.
ElectrodeRecordingData:
is_a: NwbObjectimplements:
- linkml:Arraydescription: >- A 2D array of voltage measurements from electrodes over time. This class is designed to represent either: 1) raw data from a data acquisition system in ADC units (ADU), e.g., int16 values that span a range of -32768 to 32767, that need to be converted to volts, e.g., float values from -150 mV to 250 mV, using a conversion factor (e.g., 200/32768) and offset (e.g., 50 mV). 2) data that has already been converted to volts. Storage of the raw ADC values is preferred over conversion and then storage in volts to be more efficient and represent the resolution of the original data. See ElectrodeRecording for its usage with axes labels.attributes:
per_electrode_conversion_factor:
range: floatmultivalued: true # length must match range({values}.shape[1])# default value is a list of 1sconversion_factor:
range: float# default value is 1offset_in_V:
range: floatunit:
ucum_code: V# default value is 0raw_values:
range: floatrequired: truearray:
exact_number_dimensions: 2values_in_V:
range: floatrequired: trueunit:
ucum_code: Varray:
exact_number_dimensions: 2equals_expression: "[{per_electrode_conversion_factor}[i] * {conversion_factor} * {values}[:,i] + {offset_in_V} for i in range({values}.shape[1])]"
Is your feature request related to a problem? Please describe.
The LinkML expression language has a lot of useful features, but it does not support for loops and list comprehensions. This would be useful when generating lists and arrays.
I would also like
range
to be supported.Describe the solution you'd like
For example, I want to define a class for a list of timestamps with a regular interval. It has an array attribute
values_in_s
that is defined by a starting time, sampling rate, and length. In Python, this would look liketimestamp_values = [1 / sampling_rate + start_time for i in range(length)]
Here is a more concrete example
This is important for adoption by the NWB team and for any other array cases where you don't want to store a million timestamps that can be simply computed by an equation.
How important is this feature?
• Medium - can do work without it; but it's important (e.g. to save time or for convenience)
When will use cases depending on this become relevant?
• Long-term - 6 months - 1 year
The text was updated successfully, but these errors were encountered: