Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions pySDC/helpers/fieldsIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,30 @@ class MPI:
DTYPES = {
0: np.float64, # double precision
1: np.complex128,
2: np.longdouble, # quadruple precision
3: np.clongdouble,
4: np.float32, # single precision
5: np.complex64,
}
try:
DTYPES.update(
{
2: np.float128, # quadruple precision
3: np.complex256,
}
)
except AttributeError:
import logging
Copy link
Member

@tlunet tlunet Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can logging not be a module import ? Local import with black formating makes this very ugly ... 🤡


logging.getLogger('FieldsIO').debug('Warning: Quadruple precision not available on this machine')
try:
DTYPES.update(
{
4: np.float32, # single precision
5: np.complex64,
}
)
except AttributeError:
import logging

logging.getLogger('FieldsIO').debug('Warning: Single precision not available on this machine')

DTYPES_AVAIL = {val: key for key, val in DTYPES.items()}

# Header dtype
Expand All @@ -100,7 +119,7 @@ def __init__(self, dtype, fileName):
fileName : str
File.
"""
assert dtype in DTYPES_AVAIL, f"{dtype=} not available"
assert dtype in DTYPES_AVAIL, f"{dtype=} not available. Supported on this machine: {list(DTYPES_AVAIL.keys())}"
self.dtype = dtype
self.fileName = fileName
self.initialized = False
Expand Down
Loading