Skip to content

Commit

Permalink
improve warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin committed Dec 11, 2024
1 parent 7287a5d commit 7f78db9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import warnings
from pathlib import Path
from typing import Literal, Optional

Expand Down Expand Up @@ -56,10 +57,10 @@ def __init__(
"""

if load_sync_channel:
import warnings

warnings.warn(
"The load_sync_channel parameter is deprecated and will be removed in June 2025.",
"The 'load_sync_channel' parameter is deprecated and will be removed in June 2025. "
"The sync channel data is only available the raw files of spikeglx`.",
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -165,25 +166,32 @@ def add_to_nwbfile(
always_write_timestamps : bool, default: False
If True, always writes timestamps instead of using sampling rate
"""
import warnings

if starting_time is not None:
warnings.warn(
"The 'starting_time' parameter is deprecated and will be removed in June 2025.",
"The 'starting_time' parameter is deprecated and will be removed in June 2025. "
"Use the time alignment methods for modifying the starting time or timestamps "
"of the data if needed: "
"https://neuroconv.readthedocs.io/en/main/user_guide/temporal_alignment.html",
DeprecationWarning,
stacklevel=2,
)

if write_as != "raw":
warnings.warn(
"The 'write_as' parameter is deprecated and will be removed in June 2025.",
"The 'write_as' parameter is deprecated and will be removed in June 2025. "
"NIDQ should always be written in the acquisition module of NWB. "
"Writing data as LFP or processed data is not supported.",
DeprecationWarning,
stacklevel=2,
)

if write_electrical_series is not True:
warnings.warn(
"The 'write_electrical_series' parameter is deprecated and will be removed in June 2025.",
"The 'write_electrical_series' parameter is deprecated and will be removed in June 2025. "
"The option to skip the addition of the data is no longer supported. "
"This option was used in ElectricalSeries to write the electrode and electrode group "
"metadata without the raw data.",
DeprecationWarning,
stacklevel=2,
)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_on_data/ecephys/test_nidq_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
pytest.fail(f"No folder found in location: {ECEPHY_DATA_PATH}!")


def test_nidq_interface_digital_data_only(tmp_path):
def test_nidq_interface_digital_data(tmp_path):

nwbfile_path = tmp_path / "nidq_test_digital_only.nwb"
nwbfile_path = tmp_path / "nidq_test_digital.nwb"
folder_path = ECEPHY_DATA_PATH / "spikeglx" / "DigitalChannelTest_g0"
interface = SpikeGLXNIDQInterface(folder_path=folder_path)
interface.run_conversion(nwbfile_path=nwbfile_path, overwrite=True)
Expand All @@ -35,9 +35,9 @@ def test_nidq_interface_digital_data_only(tmp_path):
np.sum(data == 0) == 163


def test_nidq_interface_analog_data_only(tmp_path):
def test_nidq_interface_analog_data(tmp_path):

nwbfile_path = tmp_path / "nidq_test_analog_only.nwb"
nwbfile_path = tmp_path / "nidq_test_analog.nwb"
folder_path = ECEPHY_DATA_PATH / "spikeglx" / "Noise4Sam_g0"
interface = SpikeGLXNIDQInterface(folder_path=folder_path)
interface.run_conversion(nwbfile_path=nwbfile_path, overwrite=True)
Expand Down

0 comments on commit 7f78db9

Please sign in to comment.