@@ -28,6 +28,10 @@ class Plexon2RecordingExtractor(NeoBaseRecordingExtractor):
2828 ids: ["source3.1" , "source3.2", "source3.3", "source3.4"]
2929 all_annotations : bool, default: False
3030 Load exhaustively all annotations from neo.
31+ reading_attempts : int, default: 25
32+ Number of attempts to read the file before raising an error
33+ This opening process is somewhat unreliable and might fail occasionally. Adjust this higher
34+ if you encounter problems in opening the file.
3135
3236 Examples
3337 --------
@@ -37,8 +41,16 @@ class Plexon2RecordingExtractor(NeoBaseRecordingExtractor):
3741
3842 NeoRawIOClass = "Plexon2RawIO"
3943
40- def __init__ (self , file_path , stream_id = None , stream_name = None , use_names_as_ids = True , all_annotations = False ):
41- neo_kwargs = self .map_to_neo_kwargs (file_path )
44+ def __init__ (
45+ self ,
46+ file_path ,
47+ stream_id = None ,
48+ stream_name = None ,
49+ use_names_as_ids = True ,
50+ all_annotations = False ,
51+ reading_attempts : int = 25 ,
52+ ):
53+ neo_kwargs = self .map_to_neo_kwargs (file_path , reading_attempts = reading_attempts )
4254 NeoBaseRecordingExtractor .__init__ (
4355 self ,
4456 stream_id = stream_id ,
@@ -50,8 +62,18 @@ def __init__(self, file_path, stream_id=None, stream_name=None, use_names_as_ids
5062 self ._kwargs .update ({"file_path" : str (file_path )})
5163
5264 @classmethod
53- def map_to_neo_kwargs (cls , file_path ):
65+ def map_to_neo_kwargs (cls , file_path , reading_attempts : int = 25 ):
66+
5467 neo_kwargs = {"filename" : str (file_path )}
68+
69+ from packaging .version import Version
70+ import neo
71+
72+ neo_version = Version (neo .__version__ )
73+
74+ if neo_version > Version ("0.13.3" ):
75+ neo_kwargs ["reading_attempts" ] = reading_attempts
76+
5577 return neo_kwargs
5678
5779
0 commit comments