MCPcopy
hub / github.com/mne-tools/mne-python / write_int

Function write_int

mne/_fiff/write.py:70–84  ·  view source on GitHub ↗

Write a 32-bit integer tag to a fif file.

(fid, kind, data)

Source from the content-addressed store, hash-verified

68
69
70def write_int(fid, kind, data):
71 """Write a 32-bit integer tag to a fif file."""
72 data_size = 4
73 data = np.asarray(data)
74 if data.dtype.kind not in "uib" and data.size > 0:
75 raise TypeError(
76 f"Cannot safely write data kind {kind} with dtype {data.dtype} as int",
77 )
78 max_val = data.max() if data.size > 0 else 0
79 if max_val > INT32_MAX:
80 raise TypeError(
81 f"Value {max_val} exceeds maximum allowed ({INT32_MAX}) for tag {kind}"
82 )
83 data = data.astype(">i4").T
84 _write(fid, data, kind, data_size, FIFF.FIFFT_INT, ">i4")
85
86
87def write_double(fid, kind, data):

Callers 15

test_write_intFunction · 0.90
_old_bad_writeFunction · 0.90
_save_partFunction · 0.85
write_bem_surfacesFunction · 0.85
_write_bem_solution_fifFunction · 0.85
_write_morph_map_Function · 0.85
write_eventsFunction · 0.85
_write_covFunction · 0.85
_write_evokedsFunction · 0.85
_write_forward_solutionFunction · 0.85
write_forward_meas_infoFunction · 0.85

Calls 1

_writeFunction · 0.85

Tested by 2

test_write_intFunction · 0.72
_old_bad_writeFunction · 0.72