Skip to content

Commit 9826634

Browse files
authored
Merge pull request #2 from h-mayorquin/intan_heberto_helping_zach
Intan heberto helping zach
2 parents 6f49801 + 4cc1aa7 commit 9826634

34 files changed

+298
-251
lines changed

neo/io/asciisignalio.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,8 @@ def write_block(self, block):
402402
if len(block.segments) > 1:
403403
raise ValueError(
404404
"Can only write blocks containing a single segment."
405-
f" This block contains {len(block.segments)} segments.")
405+
f" This block contains {len(block.segments)} segments."
406+
)
406407
self.write_segment(block.segments[0])
407408

408409
def write_metadata(self, metadata_filename=None):

neo/io/basefromrawio.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def read_block(
103103
By default None since the default is dependant on the IO
104104
load_waveforms: bool, default: False
105105
Determines whether SpikeTrains.waveforms is created
106-
106+
107107
Returns
108108
-------
109109
bl: neo.core.Block
@@ -241,7 +241,9 @@ def read_segment(
241241
"""
242242

243243
if lazy:
244-
assert time_slice is None, "For lazy=True you must specify a time_slice when LazyObject.load(time_slice=...)"
244+
assert (
245+
time_slice is None
246+
), "For lazy=True you must specify a time_slice when LazyObject.load(time_slice=...)"
245247

246248
assert (
247249
not load_waveforms

neo/io/baseio.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def read(self, lazy: bool = False, **kargs):
132132
Whether to lazily load the data (True) or to load into memory (False)
133133
kargs: dict
134134
IO specific additional arguments
135-
135+
136136
Returns
137137
------
138138
block_list: list[neo.core.Block]
@@ -163,20 +163,20 @@ def write(self, bl, **kargs):
163163
The neo Block to be written
164164
kargs: dict
165165
IO specific additional arguments
166-
166+
167167
"""
168168
if Block in self.writeable_objects:
169169
if isinstance(bl, Sequence):
170-
assert hasattr(self, "write_all_blocks"), (
171-
f"{self.__class__.__name__} does not offer to store a sequence of blocks"
172-
)
170+
assert hasattr(
171+
self, "write_all_blocks"
172+
), f"{self.__class__.__name__} does not offer to store a sequence of blocks"
173173
self.write_all_blocks(bl, **kargs)
174174
else:
175175
self.write_block(bl, **kargs)
176176
elif Segment in self.writeable_objects:
177177
assert len(bl.segments) == 1, (
178178
f"{self.__class__.__name__} is based on segment so if you try to write a block it "
179-
+ "must contain only one Segment"
179+
+ "must contain only one Segment"
180180
)
181181
self.write_segment(bl.segments[0], **kargs)
182182
else:

neo/io/elphyio.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4166,7 +4166,7 @@ def read_segment(self, episode):
41664166
t_stop=signal.t_stop * getattr(pq, signal.x_unit.strip().decode()),
41674167
# sampling_rate = signal.sampling_frequency * pq.kHz,
41684168
sampling_period=signal.sampling_period * getattr(pq, x_unit),
4169-
channel_name=f"episode {int(episode + 1)}, channel { int(channel + 1)}"
4169+
channel_name=f"episode {int(episode + 1)}, channel { int(channel + 1)}",
41704170
)
41714171
segment.analogsignals.append(analog_signal)
41724172
# create a spiketrain for each
@@ -4195,9 +4195,7 @@ def read_event(self, episode, evt):
41954195
Index of the event.
41964196
"""
41974197
event = self.elphy_file.get_event(episode, evt)
4198-
neo_event = Event(
4199-
times=event.times * pq.s, channel_name=f"episode {episode + 1}, event channel {evt + 1}"
4200-
)
4198+
neo_event = Event(times=event.times * pq.s, channel_name=f"episode {episode + 1}, event channel {evt + 1}")
42014199
return neo_event
42024200

42034201
def read_spiketrain(self, episode, spk):

neo/io/igorproio.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ def __init__(self, filename=None, parse_notes=None):
5959
"""
6060
BaseIO.__init__(self)
6161
filename = pathlib.Path(filename)
62-
assert filename.suffix[1:] in self.extensions, (
63-
f"Only the following extensions are supported: {self.extensions}"
64-
)
62+
assert filename.suffix[1:] in self.extensions, f"Only the following extensions are supported: {self.extensions}"
6563
self.filename = filename
6664
self.extension = filename.suffix[1:]
6765
self.parse_notes = parse_notes

neo/io/neomatlabio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def __init__(self, filename=None):
248248
raise ImportError(
249249
"your scipy version is too old to support "
250250
+ "MatlabIO, you need at least 0.12.0. "
251-
+ f"You have {scipy.version.version}"
251+
+ f"You have {scipy.version.version}"
252252
)
253253

254254
BaseIO.__init__(self)

neo/io/nestio.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ def __init__(self, filenames=None):
7979
if ext in self.extensions:
8080
if ext in self.avail_IOs:
8181
raise ValueError(
82-
f'Received multiple files with "{ext}" '
83-
"extension. Can only load single file of "
84-
"this type."
82+
f'Received multiple files with "{ext}" ' "extension. Can only load single file of " "this type."
8583
)
8684
self.avail_IOs[ext] = ColumnIO(filename)
8785
self.avail_formats[ext] = path
@@ -130,7 +128,7 @@ def __read_analogsignals(
130128
raise ValueError(
131129
"One or more columns have been specified to contain "
132130
"the same data. Columns were specified to {column_list_no_None}."
133-
""
131+
""
134132
)
135133

136134
# extracting condition and sorting parameters for raw data loading

neo/io/nixio.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,9 +679,7 @@ def _write_channelview(self, chview, nixblock, nixgroup):
679679

680680
# create a new data array if this channelview was not saved yet
681681
if not nix_name in self._view_map:
682-
channels = nixblock.create_data_array(
683-
f"{nix_name}.index", "neo.channelview.index", data=chview.index
684-
)
682+
channels = nixblock.create_data_array(f"{nix_name}.index", "neo.channelview.index", data=chview.index)
685683

686684
nixmt = nixblock.create_multi_tag(nix_name, "neo.channelview", positions=channels)
687685

neo/io/nwbio.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def _write_block(self, block):
481481
"""
482482
electrodes = self._write_electrodes(self._nwbfile, block)
483483
if not block.name:
484-
block.name = f"block{self.blocks_written}"
484+
block.name = f"block{self.blocks_written}"
485485
for i, segment in enumerate(block.segments):
486486
assert segment.block is block
487487
if not segment.name:
@@ -593,7 +593,8 @@ def _write_signal(self, nwbfile, signal, electrodes):
593593
)
594594
else:
595595
raise TypeError(
596-
f"signal has type { signal.__class__.__name__}, should be AnalogSignal or IrregularlySampledSignal")
596+
f"signal has type { signal.__class__.__name__}, should be AnalogSignal or IrregularlySampledSignal"
597+
)
597598
nwb_group = signal.annotations.get("nwb_group", "acquisition")
598599
add_method_map = {"acquisition": self._nwbfile.add_acquisition, "stimulus": self._nwbfile.add_stimulus}
599600
if nwb_group in add_method_map:

neo/rawio/axographrawio.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,10 @@ class AxographRawIO(BaseRawIO):
196196
... i_start=0,
197197
... i_stop=1024,
198198
... channel_names=channel_names)
199-
199+
200200
>>> float_chunk = r.rescale_signal_raw_to_float(raw_chunk,
201201
... dtype='float64',
202-
... channel_names=channel_names)
202+
... channel_names=channel_names)
203203
>>> print(float_chunk)
204204
205205
>>> # get event markers
@@ -210,7 +210,7 @@ class AxographRawIO(BaseRawIO):
210210
>>> # get interval bars
211211
>>> ep_raw_times, ep_raw_durations, ep_labels = reader.get_event_timestamps(event_channel_index=1)
212212
>>> ep_times = reader.rescale_event_timestamp(ep_raw_times, dtype='float64')
213-
>>> ep_durations = reader.rescale_epoch_duration(ep_raw_durations, dtype='float64')
213+
>>> ep_durations = reader.rescale_epoch_duration(ep_raw_durations, dtype='float64')
214214
>>> print([ep for ep in zip(ep_times, ep_durations, ep_labels)])
215215
216216
>>> # get notes
@@ -564,12 +564,14 @@ def _scan_axograph_file(self):
564564
# format version 3
565565
if header_id == "AxGr":
566566
format_ver, n_cols = f.read_f("HH")
567-
assert (
568-
format_ver == 1 or format_ver == 2
569-
), f'mismatch between header identifier "{header_id}" and format ' f'version "{format_ver}"!'
567+
assert format_ver == 1 or format_ver == 2, (
568+
f'mismatch between header identifier "{header_id}" and format ' f'version "{format_ver}"!'
569+
)
570570
elif header_id == "axgx":
571571
format_ver, n_cols = f.read_f("ll")
572-
assert format_ver >= 3, f'mismatch between header identifier "{header_id}" and format ' f'version "{format_ver}"!'
572+
assert format_ver >= 3, (
573+
f'mismatch between header identifier "{header_id}" and format ' f'version "{format_ver}"!'
574+
)
573575
else:
574576
raise NotImplementedError(f'unimplemented file header identifier "{header_id}"!')
575577
self.info["format_ver"] = format_ver
@@ -666,8 +668,7 @@ def _scan_axograph_file(self):
666668
first_value, increment = f.read_f("ff")
667669

668670
self.logger.debug(f"interval: {increment}, freq: {1 / increment}")
669-
self.logger.debug(
670-
f"start: {first_value}, end: {first_value + increment * (n_points - 1)}")
671+
self.logger.debug(f"start: {first_value}, end: {first_value + increment * (n_points - 1)}")
671672

672673
# assume this is the time column
673674
t_start, sampling_period = first_value, increment
@@ -702,9 +703,7 @@ def _scan_axograph_file(self):
702703
first_value, increment = f.read_f("dd")
703704

704705
self.logger.debug(f"interval: {increment}, freq: {1 / increment}")
705-
self.logger.debug(
706-
"start: {first_value}, end: {first_value + increment * (n_points - 1)}"
707-
)
706+
self.logger.debug("start: {first_value}, end: {first_value + increment * (n_points - 1)}")
708707

709708
if i == 0:
710709

@@ -792,9 +791,7 @@ def _scan_axograph_file(self):
792791
first_value = array[0]
793792

794793
self.logger.debug(f"interval: {increment}, freq: {1 / increment}")
795-
self.logger.debug(
796-
f"start: {first_value}, end: {first_value + increment * (n_points - 1)}"
797-
)
794+
self.logger.debug(f"start: {first_value}, end: {first_value + increment * (n_points - 1)}")
798795

799796
t_start, sampling_period = first_value, increment
800797
self.info["t_start"] = t_start
@@ -993,9 +990,7 @@ def _scan_axograph_file(self):
993990

994991
self.logger.debug(f"old_unknown_episode_list: {old_unknown_episode_list}")
995992
if n_episodes2 != n_episodes:
996-
self.logger.debug(
997-
f"n_episodes2 ({n_episodes2}) and n_episodes ({n_episodes}) " "differ!"
998-
)
993+
self.logger.debug(f"n_episodes2 ({n_episodes2}) and n_episodes ({n_episodes}) " "differ!")
999994

1000995
# another list of episode indexes with unknown purpose
1001996
unknown_episode_list = []
@@ -1062,8 +1057,10 @@ def _scan_axograph_file(self):
10621057
assert font_settings_info["setting1"] in [
10631058
FONT_BOLD,
10641059
FONT_NOT_BOLD,
1065-
], f"expected setting1 ({ font_settings_info['setting1']}) to have value FONT_BOLD " f"({FONT_BOLD}) or FONT_NOT_BOLD ({FONT_NOT_BOLD})"
1066-
1060+
], (
1061+
f"expected setting1 ({ font_settings_info['setting1']}) to have value FONT_BOLD "
1062+
f"({FONT_BOLD}) or FONT_NOT_BOLD ({FONT_NOT_BOLD})"
1063+
)
10671064

10681065
# size is stored 10 times bigger than real value
10691066
font_settings_info["size"] = font_settings_info["size"] / 10.0

0 commit comments

Comments
 (0)