Skip to content

Commit

Permalink
- Fixed read_seq not inserting the same format into adc_library a…
Browse files Browse the repository at this point in the history
…s when regularly inserting an ADC event

- Fixed `read_seq` not inserting `tuple`s
- Removed check for format of `adc_library` data in `get_block` that is now unnecessary
  • Loading branch information
FrankZijlstra authored and btasdelen committed Sep 25, 2023
1 parent d5df758 commit b4b7782
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 0 additions & 2 deletions pypulseq/Sequence/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,6 @@ def get_block(self, block_index: int) -> SimpleNamespace:
# ADC
if event_ind[5] > 0:
lib_data = self.adc_library.data[event_ind[5]]
if len(lib_data) < 6:
lib_data = np.concatenate((lib_data, [0]))

adc = SimpleNamespace()
(
Expand Down
7 changes: 5 additions & 2 deletions pypulseq/Sequence/read_seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def read(self, path: str, detect_rf_use: bool = False) -> None:
)
elif section == "[ADC]":
self.adc_library = __read_events(
input_file, (1, 1e-9, 1e-6, 1, 1), event_library=self.adc_library
input_file, (1, 1e-9, 1e-6, 1, 1), event_library=self.adc_library, append=self.system.adc_dead_time
)
elif section == "[DELAYS]":
if version_combined >= 1004000:
Expand Down Expand Up @@ -469,6 +469,7 @@ def __read_events(
scale: tuple = (1,),
event_type: str = str(),
event_library: EventLibrary = EventLibrary(),
append=None
) -> EventLibrary:
"""
Read an event section of a sequence file and return a library of events.
Expand All @@ -494,7 +495,9 @@ def __read_events(
while line != "" and line != "#":
data = np.fromstring(line, dtype=float, sep=" ")
event_id = data[0]
data = data[1:] * scale
data = tuple(data[1:] * scale)
if append != None:
data = data + (append,)
if event_type == "":
event_library.insert(key_id=event_id, new_data=data)
else:
Expand Down

0 comments on commit b4b7782

Please sign in to comment.