Skip to content

Commit

Permalink
Deprecate old SpikeSorting task
Browse files Browse the repository at this point in the history
  • Loading branch information
k1o0 committed Jun 25, 2024
1 parent 4b9737a commit 7e09fe2
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ibllib/pipes/ephys_preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
from ibllib.plots.snapshot import ReportSnapshot
from brainbox.behavior.dlc import likelihood_threshold, get_licks, get_pupil_diameter, get_smooth_pupil_diameter

_logger = logging.getLogger("ibllib")
warnings.warn('`pipes.training_preprocessing` to be removed in favour of dynamic pipeline')
_logger = logging.getLogger('ibllib')
warnings.warn('`pipes.ephys_preprocessing` to be removed in favour of dynamic pipeline', DeprecationWarning)


# level 0
Expand All @@ -53,7 +53,7 @@ class EphysPulses(tasks.Task):
io_charge = 30 # this jobs reads raw ap files
priority = 90 # a lot of jobs depend on this one
level = 0 # this job doesn't depend on anything
force = False # whether or not to force download of missing data on local server if outputs already exist
force = False # whether to force download of missing data on local server if outputs already exist
signature = {
'input_files': [('*ap.meta', 'raw_ephys_data/probe*', True),
('*ap.ch', 'raw_ephys_data/probe*', False), # not necessary when we have .bin file
Expand Down Expand Up @@ -219,7 +219,7 @@ def _run(self, overwrite=False):

class SpikeSorting(tasks.Task):
"""
Pykilosort 2.5 pipeline
(DEPRECATED) Pykilosort 2.5 pipeline
"""
gpu = 1
io_charge = 100 # this jobs reads raw ap files
Expand All @@ -238,6 +238,12 @@ class SpikeSorting(tasks.Task):
'output_files': [] # see setUp method for declaration of inputs
}

def __init__(self, *args, **kwargs):
warnings.warn('`pipes.ephys_preprocessing.SpikeSorting` to be removed '
'in favour of `pipes.ephys_tasks.SpikeSorting`',
DeprecationWarning)
super().__init__(*args, **kwargs)

@staticmethod
def spike_sorting_signature(pname=None):
pname = pname if pname is not None else "probe*"
Expand Down
59 changes: 59 additions & 0 deletions ibllib/tests/test_pipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,5 +795,64 @@ def dummy_function(arg1, arg2):
self.assertEqual(result, ("test1", "test2"))


class TestLegacyDeprecations(unittest.TestCase):
"""Assert removal of old code."""

def test_remove_legacy_pipeline(self):
"""Remove old legacy pipeline code.
The following code is an incomplete list of modules and functions that should be removed:
- pipes.ephys_preprocessing
- pipes.training_preprocessing
- io.extractors.biased_trials.extract_all
- io.extractors.bpod_trials.extract_all
- io.extractors.base.get_session_extractor_type
- io.extractors.base.get_pipeline
- io.extractors.base._get_pipeline_from_task_type
- io.extractors.base._get_task_types_json_config
- io.extractors.extractor_types.json
- qc.task_extractors.TaskQCExtractor.extract_data
NB: some tasks in ephys_preprocessing and maybe training_preprocessing may be directly used
or subclassed by the dynamic pipeline. The TaskQCExtractor class could be removed entirely.
Instead, a function could exist to simply fetch the relevant data from the task's extractor
class. Alos, there may be plenty of iblscripts CI tests to be removed.
"""
self.assertTrue(datetime.today() < datetime(2024, 9, 1), 'remove legacy pipeline')

def test_remove_legacy_rig_code(self):
"""Remove old legacy (v7) rig code.
The following code is an incomplete list of modules and functions that should be removed:
- pipes.transfer_rig_data
- pipes.misc.check_transfer
- pipes.misc.transfer_session_folders
- pipes.misc.copy_with_check
- pipes.misc.backup_session
- pipes.misc.transfer_folder
- pipes.misc.load_videopc_params
- pipes.misc.load_ephyspc_params
- pipes.misc.create_basic_transfer_params
- pipes.misc.create_videopc_params
- pipes.misc.create_ephyspc_params
- pipes.misc.rdiff_install
- pipes.misc.rsync_paths
- pipes.misc.confirm_ephys_remote_folder
- pipes.misc.create_ephys_flags
- pipes.misc.create_ephys_transfer_done_flag
- pipes.misc.create_video_transfer_done_flag
- pipes.misc.create_transfer_done_flag
pipes.misc.backup_session may be worth keeping and utilized by the iblrig code (arguably
useful on both rig and local server). The corresponding tests should also be removed.
In addition some iblscripts.deploy files should be removed, e.g. prepare_ephys_session,
prepare_video_session.
"""
self.assertTrue(datetime.today() < datetime(2024, 10, 1), 'remove legacy rig code')


if __name__ == '__main__':
unittest.main(exit=False, verbosity=2)

0 comments on commit 7e09fe2

Please sign in to comment.