|
a |
|
b/doc/_includes/precision.rst |
|
|
1 |
:orphan: |
|
|
2 |
|
|
|
3 |
Floating-point precision |
|
|
4 |
======================== |
|
|
5 |
|
|
|
6 |
.. NOTE: part of this file is included in doc/manual/io.rst and |
|
|
7 |
doc/overview/implementation.rst. Changes here are reflected there. If you |
|
|
8 |
want to link to this content, link to :ref:`manual-precision` for the manual |
|
|
9 |
or :ref:`precision` for the implementation page. The next line is a target |
|
|
10 |
for :start-after: so we can omit the title above: |
|
|
11 |
precision-begin-content |
|
|
12 |
|
|
|
13 |
MNE-Python performs all computation in memory using the double-precision 64-bit |
|
|
14 |
floating point format. This means that the data is typecast into float64 format |
|
|
15 |
as soon as it is read into memory. The reason for this is that operations such |
|
|
16 |
as filtering and preprocessing are more accurate when using the 64-bit format. |
|
|
17 |
However, for backward compatibility, MNE-Python writes :file:`.fif` files in a |
|
|
18 |
32-bit format by default. This reduces file size when saving data to disk, but |
|
|
19 |
beware that *saving intermediate results to disk and re-loading them from disk |
|
|
20 |
later may lead to loss in precision*. If you would like to ensure 64-bit |
|
|
21 |
precision, there are two possibilities: |
|
|
22 |
|
|
|
23 |
- Chain the operations in memory and avoid saving intermediate results. |
|
|
24 |
|
|
|
25 |
- Save intermediate results but change the :class:`~numpy.dtype` used for |
|
|
26 |
saving, by using the ``fmt`` parameter of :meth:`mne.io.Raw.save` (or |
|
|
27 |
:meth:`mne.Epochs.save`, etc). However, note that this may render the |
|
|
28 |
:file:`.fif` files unreadable in software packages other than MNE-Python. |