Skip to content

Commit 1999c6d

Browse files
committed
not deserializing data
1 parent ceb1832 commit 1999c6d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

rocketpy/simulation/monte_carlo.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,7 @@ def _write_data_worker(
755755
data_size,
756756
stop_event,
757757
):
758+
sim_idx = 0
758759
with h5py.File(file_path, 'a') as h5_file:
759760
# loop until the stop event is set
760761
while not stop_event.is_set():
@@ -764,13 +765,15 @@ def _write_data_worker(
764765
if sem.acquire(timeout=1e-3):
765766
# retrieve the data from the shared buffer
766767
data = shared_buffer[i * data_size : (i + 1) * data_size]
767-
data_dict = pickle.loads(bytes(data))
768+
# data_dict = pickle.loads(bytes(data))
768769

769770
# write data to the file
770-
MonteCarlo.__dict_to_h5(h5_file, '/', data_dict)
771-
771+
grp = h5_file.create_group(f"{sim_idx}")
772+
grp.create_dataset("data", data=data)
773+
772774
# release the write semaphore // tell worker it can write again
773775
go_write_semaphores[i].release()
776+
sim_idx += 1
774777
# print(f"Wrote data to file. Buffer pos: {i}")
775778

776779
# loop through all the semaphores to write the remaining data
@@ -779,13 +782,15 @@ def _write_data_worker(
779782
if sem.acquire(timeout=1e-3):
780783
# retrieve the data from the shared buffer
781784
data = shared_buffer[i * data_size : (i + 1) * data_size]
782-
data_dict = pickle.loads(bytes(data))
785+
# data_dict = pickle.loads(bytes(data))
783786

784787
# write data to the file
785-
MonteCarlo.__dict_to_h5(h5_file, '/', data_dict)
788+
grp = h5_file.create_group(f"{sim_idx}")
789+
grp.create_dataset("data", data=data)
786790

787791
# release the write semaphore // tell worker it can write again
788792
go_write_semaphores[i].release()
793+
sim_idx += 1
789794

790795
@staticmethod
791796
def __downsample_recursive(data_dict, max_time, sample_time):

0 commit comments

Comments
 (0)