Skip to content

Commit 081ed02

Browse files
committed
remove the condition before if
1 parent d1c9c1c commit 081ed02

File tree

1 file changed

+23
-26
lines changed

1 file changed

+23
-26
lines changed

element_interface/intan_loader.py

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -269,30 +269,27 @@ def load_rhs(folder: str, file_expr: str = "*"):
269269
# Get recording data
270270
rhs_data["recordings"] = {}
271271

272-
if len(file_paths):
273-
for file_path in sorted(file_paths):
274-
signal_type = file_path.stem.split("-")[0]
275-
276-
if signal_type == "amp":
277-
signal = np.memmap(file_path, dtype=np.int16)
278-
signal = signal * 0.195 # Convert to microvolts
279-
280-
elif signal_type == "board":
281-
signal = np.memmap(file_path, dtype=np.uint16)
282-
signal = (signal - 32768) * 0.0003125 # Convert to volts
283-
284-
elif signal_type == "dc":
285-
signal = np.memmap(file_path, dtype=np.uint16)
286-
signal = (signal - 512) * 19.23 # Convert to milivolts
287-
288-
elif signal_type == "stim":
289-
signal = np.memmap(file_path, dtype=np.uint16)
290-
# convert the signal from 9-bit one's complement to standard encoding
291-
current = (
292-
np.bitwise_and(signal, 255) * rhs_data["header"]["stim_step_size"]
293-
)
294-
sign = 1 - np.bitwise_and(signal, 256) // 128
295-
signal = current * sign
296-
297-
rhs_data["recordings"][file_path.stem] = signal
272+
for file_path in sorted(file_paths):
273+
signal_type = file_path.stem.split("-")[0]
274+
275+
if signal_type == "amp":
276+
signal = np.memmap(file_path, dtype=np.int16)
277+
signal = signal * 0.195 # Convert to microvolts
278+
279+
elif signal_type == "board":
280+
signal = np.memmap(file_path, dtype=np.uint16)
281+
signal = (signal - 32768) * 0.0003125 # Convert to volts
282+
283+
elif signal_type == "dc":
284+
signal = np.memmap(file_path, dtype=np.uint16)
285+
signal = (signal - 512) * 19.23 # Convert to milivolts
286+
287+
elif signal_type == "stim":
288+
signal = np.memmap(file_path, dtype=np.uint16)
289+
# convert the signal from 9-bit one's complement to standard encoding
290+
current = np.bitwise_and(signal, 255) * rhs_data["header"]["stim_step_size"]
291+
sign = 1 - np.bitwise_and(signal, 256) // 128
292+
signal = current * sign
293+
294+
rhs_data["recordings"][file_path.stem] = signal
298295
return rhs_data

0 commit comments

Comments
 (0)