Skip to content

Commit

Permalink
FIX copy memory explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgWa committed Nov 23, 2023
1 parent 8e39a1b commit 930c3fa
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions alpharaw/thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,21 @@ def _import_batch(
isolation_mz_uppers.append(isolation_center + isolation_width / 2)
precursor_charges.append(charge)
rawfile.Close()

# copys of numpy arrays are needed to move them explicitly to cpython heap
# otherwise mono might interfere later
return {
'_peak_indices': _peak_indices,
'peak_mz': np.concatenate(mz_values),
'peak_intensity': np.concatenate(intensity_values),
'rt': np.array(rt_values),
'precursor_mz': np.array(precursor_mz_values),
'precursor_charge': np.array(precursor_charges, dtype=np.int8),
'isolation_lower_mz': np.array(isolation_mz_lowers),
'isolation_upper_mz': np.array(isolation_mz_uppers),
'ms_level': np.array(ms_order_list, dtype=np.int8),
'nce': np.array(ce_list, dtype=np.float32),
'injection_time': np.array(injection_time_list, dtype=np.float32)
'peak_mz': np.concatenate(mz_values).copy(),
'peak_intensity': np.concatenate(intensity_values).copy(),
'rt': np.array(rt_values).copy(),
'precursor_mz': np.array(precursor_mz_values).copy(),
'precursor_charge': np.array(precursor_charges, dtype=np.int8).copy(),
'isolation_lower_mz': np.array(isolation_mz_lowers).copy(),
'isolation_upper_mz': np.array(isolation_mz_uppers).copy(),
'ms_level': np.array(ms_order_list, dtype=np.int8).copy(),
'nce': np.array(ce_list, dtype=np.float32).copy(),
'injection_time': np.array(injection_time_list, dtype=np.float32).copy()
}
class ThermoRawData(MSData_Base):
"""
Expand Down

0 comments on commit 930c3fa

Please sign in to comment.