# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

*No unreleased changes.*

## [0.0.3b0] - 2026-03-30

### Added

- `AllegoClient.load_all_mosi(register_vals)`: Load MOSI register values into a connected Sinaps probe.
- `AllegoClient.transmit_mosi()`: Transmit the loaded MOSI registers to the Sinaps probe.
- `AllegoClient.read_wire_out(wire_out_address)`: Read a wire-out register value from the Sinaps FPGA.
- `AllegoClient.get_sinaps_status_registers()`: Retrieve Sinaps probe status (calibration state, active pixel counts, reference voltages, error flags, and probe identity). Returns `SinapsStatusRegisters`.
- `AllegoClient.flash_sinaps(bitfile)`: Flash new firmware to the Sinaps probe FPGA.
- `SinapsStatusRegisters`: New domain model exposing all Sinaps probe status fields.
- `AllegoClient.start_streaming()` / `stop_streaming()`: Explicit action methods replacing `set_stream_state()`.
- `AllegoClient.start_recording(*, port?)` / `stop_recording(*, port?)`: Explicit action methods replacing `set_record_state()`.
- `AllegoClient.set_stim_trigger(*, trigger, on)`: Set stimulation trigger state directly; replaces `manual_stim_trigger()`.
- `AllegoClient.toggle_stim_trigger(*, trigger)`: Toggle stimulation trigger; replaces `manual_stim_trigger_toggle()`.
- `AllegoClient.update_recording_config(config)`: Clearer name for applying a recording config partial update; replaces `set_recording_config()`.
- `AllegoClient.update_core_config(*, samp_freq?, loop_dur?, pcache_persistence?, cable_delay?)`: Replaces `set_core_config()`. All parameters are keyword-only and optional — only supplied fields are sent to the server.
- `AllegoClient.enable_trigger(*, channel, port?)`: Enable a digital trigger channel to automatically start/stop recording on a voltage transition.
- `AllegoClient.disable_trigger(*, channel, port?)`: Disable a specific trigger channel.
- `AllegoClient.disable_all_triggers()`: Disable all active trigger channels simultaneously.
- `TriggerChannel` is now exported from the top-level `radiens_core` package.
- `FlexDataset`: new annotated type (`DatasetMetadata | str | Path`) used across all `VidereClient` and `CurateClient` dataset-taking methods. Provides clearer type signatures and better error messages when an invalid type is passed.

### Changed

- `AllegoClient.restart()` now takes `*, mode: BackboneMode` as a keyword-only argument instead of a `RestartRequest` model.
- `AllegoClient.set_stim_step()` now takes `*, step: StimStep` as a keyword-only argument instead of a `StimStepRequest` model.
- `VidereClient.set_dsp_group()` now takes `stage` and `params` as keyword-only arguments.

### Deprecated

- `AllegoClient.set_stream_state()`: Use `start_streaming()` or `stop_streaming()` instead.
- `AllegoClient.set_record_state()`: Use `start_recording()` or `stop_recording()` instead.
- `AllegoClient.manual_stim_trigger()`: Use `set_stim_trigger()` instead.
- `AllegoClient.manual_stim_trigger_toggle()`: Use `toggle_stim_trigger()` instead.
- `AllegoClient.set_recording_config()`: Use `update_recording_config()` instead.
- `AllegoClient.set_core_config()`: Use `update_core_config()` instead.
- `AllegoClient.set_trigger_state()`: Use `enable_trigger()`, `disable_trigger()`, or `disable_all_triggers()` instead.

## [0.0.2] - 2026-03-25

### Added

- `VidereClient.get_spikes_spec()`: Retrieve spike interface metadata for a linked dataset.
- `VidereClient.get_spikes_by_channel()`: Retrieve spike timestamps and neuron labels per recording channel, with optional waveform snippets.
- `VidereClient.get_spikes_by_neuron()`: Same spike data regrouped by sorted neuron identity.
- `VidereClient.get_neurons()`: Retrieve neuron descriptors (spike count, rate, SNR, waveform peak amplitude, probe position) per channel.
- New domain models: `SpikesSpec`, `ChannelSpikeData`, `NeuronSpikeData`, `NeuronsResult`, `NeuronInfo`.
- `DatasetMetadata.associated_spikes_ids`: List of registered spikes datasource IDs discovered when the recording file was linked.

### Changed

- `link_data_file()` now automatically discovers and registers any associated `.spikes` file alongside the recording, populating `DatasetMetadata.associated_spikes_ids`. No change required at the call site.

## [0.0.1] - 2026-03-23

Initial stable release. All three clients (`AllegoClient`, `VidereClient`, `CurateClient`) with zero-config service discovery, strict mypy typing, and Pydantic v2 domain models.

### Added

#### AllegoClient (Real-time Acquisition)

- `healthcheck()`, `get_status()`, `set_stream_state()`, `set_record_state()`, `restart()` for session lifecycle.
- `get_signals()` for real-time signal data retrieval with `FlexTimeRange` / `FlexSignalSpec` convenience types.
- `get_channel_metadata()` for channel information.
- `get_stim_params()`, `set_stim_params()`, `set_trigger_control()` for stimulation control, including `headstage_global_amp_settle`.
- `get_recording_config()` and related methods for recording configuration.
- `get_dsp_group()` and `set_dsp_group()` for real-time filter configuration.
- `get_core_config()` and `set_core_config()` for global hardware settings (sampling frequency, loop duration, cable delays).
- `get_intan_impedance()` for channel impedance measurement and `scan_ports()` for hardware discovery.
- `get_dac_reg()`, `set_dac_gain()`, `set_dac_stream()`, `set_dac_off()`, `set_dac_highpass()` for DAC control.
- `get_dio_reg()`, `set_dio_events()`, `set_dio_manual()`, `set_dio_gated()`, `set_dio_pulse()` for Digital Output control.
- `get_kpi_metrics()`, `get_kpi_status()`, `set_kpi_packet_dur()`, `set_kpi_update_period()` for real-time signal-quality metrics.

#### VidereClient (Offline Analysis)

- `link_data_file()` for linking recorded data files (`.xdat`, `.rhd`).
- `get_signals()` for offline signal data retrieval.
- `get_dsp_group()` and `set_dsp_group()` for offline filter configuration.
- `list_data_sources()`, `list_data_source_ids()`, `clear_data_sources()`, `export_data_source()` for data source management.
- `get_kpi_metrics()`, `get_kpi_status()`, `kpi_calculate()`, `kpi_clear()`, `set_kpi_packet_dur()` for offline signal-quality metrics.

#### CurateClient (Data Curation)

- `link_data_file()` with `Path` support and progress bars.
- `slice_time()` and `slice_channels()` for time and channel subsetting.
- `downsample()` for sample-rate reduction.
- `highpass()`, `lowpass()`, `bandpass()`, `bandstop()`, `notch()` for filtering transforms.
- `car()` for Common Average Reference, `virtual_ref()` and `paired_ref()` for re-referencing.
- `set_protocol()` for registering arbitrary multi-step transform graphs (DAGs).

#### Domain Models

- `StimParams` with stimulation enums and `headstage_global_amp_settle`.
- `DSPGroup`, `DSPParams`, `DSPType`, `FilterStage` for filter configuration.
- `CoreConfig`, `CableDelay`, `SetCoreConfigRequest` for hardware settings.
- `Impedance`, `ImpedanceValue` for impedance data.
- `AnalogOutRegister`, `AnalogOutChannel`, `DACHighPass` for DAC configuration.
- `DigitalOutRegister`, `DigitalOutChannelRegister`, `DIOMode` for DIO configuration.
- `KpiMetric`, `KpiMetricId`, `KpiMetricsResult`, `KpiMode`, `KpiStatus` for signal-quality metrics.
- `TransformNode`, `TransformEdge`, `TransformNodeType` and all transform parameter models for curation protocols.
- `FlexTimeRange` and `FlexSignalSpec` convenience types with Pydantic runtime coercion.

#### Infrastructure

- Zero-config authentication via `AuthInterceptor`.
- Auto-discovery of server UUID and service endpoints.
- `BaseClient` with shared gRPC channel pool and lifecycle management.
- Proto-driven type safety architecture with `_converters/` / `_services/` layer separation.
- MkDocs documentation site with auto-generated API reference.
- Automated PyPI publishing via GitHub Actions (Trusted Publishing).
