Skip to content

Conversation

@bkeryan
Copy link
Collaborator

@bkeryan bkeryan commented Apr 11, 2025

What does this Pull Request accomplish?

Add the AnalogWaveform[_ScalarType_co] class, supporting the following operations:

  • Construct a waveform with the specified sample count and/or capacity.
  • Construct a wavefrom from a 1D array (np.ndarray, array.array) or sequence.
  • Construct a list of waveforms from a 2D array (np.ndarray, Sequence[array.array]) or nested sequence.
  • Access the waveform's raw and scaled data.
  • Get and set extended properties.

AnalogWaveform[_ScalarType_co] is a generic class with the following type inference behavior:

  • Constructing without a dtype returns an AnalogWaveform[np.float64].
  • Constructing with a dtype literal returns an AnalogWaveform with that dtype, such as AnalogWaveform[np.int32].
  • Constructing with a dtype string returns an AnalogWaveform[Any] because we can't infer the dtype in this case.
  • AnalogWaveform.from_array_1d() and AnalogWaveform.from_array_2d() infer the data type from the input array, when possible.

Not implemented yet:

  • Appending
  • Scaling
  • Getting and setting timing information

Why should this Pull Request be merged?

This is a significant chunk of the analog waveform functionality.

Implements AB#3082080

What testing has been done?

Wrote unit tests.

@bkeryan bkeryan requested a review from csjall as a code owner April 11, 2025 19:34
@github-actions
Copy link
Contributor

github-actions bot commented Apr 11, 2025

Test Results

 10 files  ±  0   10 suites  ±0   10s ⏱️ +8s
 88 tests + 87   88 ✅ + 87  0 💤 ±0  0 ❌ ±0 
880 runs  +870  880 ✅ +870  0 💤 ±0  0 ❌ ±0 

Results for commit dff8c33. ± Comparison against base commit 77a431f.

♻️ This comment has been updated with latest results.

@bkeryan bkeryan merged commit 15fe7ae into main Apr 14, 2025
13 checks passed
@bkeryan bkeryan deleted the users/bkeryan/analog-waveform branch April 14, 2025 22:15
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.

3 participants