File formats¶
otswap reads and writes tables in two formats, chosen by the file’s extension,
whatever its case: .fits, .fit and .fits.gz are FITS, anything else is
ASCII. The C++ functions are in the namespace otswap::io, the Python ones in
the module otswap.io; both run the same code, so a file written from Python
is the same, byte for byte, as the one the C++ library writes from the same
values. The names of the files the otswap executable writes are on the
executable page, and the syntax of its parameter files at
the end of this page.
A table of one’s own¶
A table is written from its columns and read back by column name; an ID column is written and read exactly, as 64-bit integers, and the keywords come back as strings:
import numpy as np
import otswap
rng = np.random.default_rng(1)
x, y, z = rng.random((3, 5))
ids = np.arange(100, 105)
columns = [otswap.io.Column("id", ids, type="K", description="catalogue ID"),
otswap.io.Column("x", x), otswap.io.Column("y", y), otswap.io.Column("z", z)]
otswap.io.write("points.dat", columns, keywords=[("SIDE", "1", "box side")])
table = otswap.io.read("points.dat", ["x", "y", "z"], integer_columns=["id"])
positions, read_ids = table.values, table.integers[:, 0]
keywords = {name: value for name, value, _ in otswap.io.read_keywords("points.dat")}
The C++ functions have the same names in camelCase (names side by
side). With points.fits the same lines write and read a
FITS table; read_keywords then also returns the structural cards of the
table (XTENSION, TTYPE1, …) before the caller’s.
Reading¶
otswap::io::read() and otswap.io.read() read selected
columns of a table, as double, and others exactly as 64-bit integers.
FITS: the table in HDU 2; columns by name, case insensitively, scalar; an integer column must have an integer type.
ASCII: a column given by digits alone is a 0-based index; any other name is looked up in the last line starting with
###before the first data row, where otswap writes the names. A header such as# RA Dec z, written by another program, gives no names: read its columns by index. Lines that are empty, hold only separators, start with the comment character (#by default) after any separators, or start with###(a names line, whatever the comment character) are skipped; every other line is a data row, so a header line must start with the comment character. Fields are separated by the delimiter, blanks or tabs. Each requested field, and the first field of every data row, must be a number as a whole: decimal, hexadecimal (0x10),nan,inforinfinity, in any case and with an optional sign;NA,1,5with a blank delimiter,4.5abcor1eis an error. A carriage return ending a line is ignored. An integer field is an optional-followed by digits.Messages name an ASCII line as the file shows it, counted from 1 with comments and blank lines, a field counted from 1, and a FITS row counted from 1; a row that
writeis given in memory is counted from 0. These messages state which, as “(from 1)” or “(from 0)”.NaN and infinities are returned as stored, in both formats, so a file written with NaN rows reads back with them.
otswap::io::readKeywords() and otswap.io.read_keywords()
read the keywords of a table, and otswap::io::columnNames() and
otswap.io.column_names() the names of its columns, those read
finds: in FITS the TTYPEn of the table, in ASCII the fields of the last
### line before the first data row.
A file can hold several tables, written by otswap::io::writeParts()
or otswap.io.write_parts(): in FITS one extension per table, each
named by its EXTNAME; in ASCII the first table in the file and each other one
in a twin file of its own (otswap::io::twinFile()). Every table,
the first included, is read by otswap::io::readPart() or
otswap.io.read_part() from its EXTNAME and twin name, and its
keywords by readKeywords with the EXTNAME, or on the twin file that
twinFile names. readPart reads any FITS table by its EXTNAME, whoever
wrote it.
The other inputs:
A mask: a full-sky HEALPix map, from a FITS file (
otswap::Mask,otswap.Mask), in RING or NESTED order, or from an array in memory (otswap.Mask.from_array()). A pixel is observed when its value is greater than 0.A bias table: b(z) at redshift nodes, read by
otswap::io::readBiasTable()andotswap.io.read_bias_table(): FITS from the columnsREDSHIFTandBIAS, ASCII from the first two columns; the bias is dimensionless.A distance table: computed from a flat cosmology, or built from the caller’s own columns (
otswap.DistanceTable.from_table()), for example read withread. Its distances set the coordinate units of a lightcone given on the sky (Mpc/h from the cosmology); with Cartesian coordinates they must be in the unit of the coordinates.
The two layouts¶
The layouts of every table otswap writes, with otswap::io::write(),
otswap.io.write() or one of the writers below:
- group File formats
The layouts of the tables io::write, io::writeParts and the writers produce.
ASCII:
## PRODUCT = displacements / what the file holds # tracX comoving position of the tracer # ... # ### tracX tracY tracZ ... 269.123 ...
one “## NAME = value / comment” line per keyword, when keywords are given;
one “# name description [unit]” line per column with a description or a unit, the names padded to a common width, and a line holding “#” alone after the keyword and description lines, when there are any;
the “###” line, with the column names;
one line per row, values separated by single spaces: ‘D’ with WriteOptions::precision significant digits, a NaN as nan whatever its sign, ‘J’ and ‘K’ as integers.
Every header line starts with ‘#’, so io::read, numpy.loadtxt and most table readers skip them.
FITS: a new file, its table in HDU 2 as a binary table of 1D, 1J and 1K columns; descriptions in TCOMMn, units in TUNITn, keywords in the header of HDU 2. The displacement writers name that table DISPLACEMENTS (EXTNAME); the complete displacement file adds one HDU per further table, each named by its EXTNAME, which an ASCII file writes as twin files of its own. io::writeParts writes such files from the caller’s tables.
The writers of a Result and of a RealSpaceCatalog write one row per input object, in input order (the complete displacement file: one row per realization and object), tracers left out of the reconstruction included, with NaN where nothing was computed, so row i of a file describes object i of the input. The id column, where written, holds the object’s ID (Result::ids, RealSpaceCatalog::ids), or i when no IDs were set. Angles are in degrees, right ascension in [0, 360) but in the complete displacement file, which keeps it as given. Lengths are in coordinate units (see the coordinate layout), which otswap cannot know, so their columns carry no unit and their keywords say “in coordinate
units”. Each column has a description and, where it has one, a unit. Every header carries PRODUCT, what the file holds, and OTSWAPV, the library version; those of a Result or a RealSpaceCatalog also carry GEOMETRY, box, lightcone_sky or lightcone_cartesian (a file of otswap 0.4 or earlier, which writes lightcone for both, is read as lightcone_sky), and NOBJECTS; then those of the product, listed with each writer.
The writers¶
Each product has its writer, the same in both languages. The groups of columns and the keywords are listed with each.
C++ |
Python |
Writes |
|---|---|---|
|
|
the mean displacement of each tracer |
|
|
every realization, losslessly, with what a reader needs |
|
|
a catalogue moved to real space |
|
|
a mean particle separation profile |
The two displacement files have their readers, which rebuild a Result:
C++ |
Python |
Reads |
|---|---|---|
|
|
a mean displacement file of otswap 0.2 or later, as a |
|
|
a complete displacement file of otswap 0.1 or later |
The complete file is lossless in both formats; the precision of the mean file
is given under otswap::io::writeDisplacementMean() below. A mean
file of otswap 0.1 is refused; a complete file of otswap 0.1 is read, its
index column as the IDs. The corrected catalogue and the profile have no
reader of their own: otswap::io::read() reads their columns by
name.
Angles in the files are in degrees. The Python readers take
angle_unit, the unit of the sky arrays of the Result they return: required
for a lightcone file, refused for a box file, which has no angles.
A periodic box and a lightcone given in Cartesian coordinates are written in
the same files, with what tells them apart: the keyword PERIODIC and the
counts of wrapped objects, each when not 0, for the former; for the latter,
the keyword GEOMETRY (lightcone_cartesian), the distance cut, the column
outsideDistanceCut, written for every Cartesian result (the column
outsideRedshiftCut is then all 0), and, when the result has one, a profile
in distance. A Cartesian result reconstructed without a distance table
has NaN in its redshift columns and no distance table part. Each writer below
lists what it writes.
In Python the groups are strings, the C++ names in snake case
(DisplacementGroup::TracerSky is "tracer_sky").
Displacements¶
-
void otswap::io::writeDisplacementMean(const std::string &file, const Result &result, const std::vector<DisplacementGroup> &groups = {}, bool lightconeTables = true)¶
Write the mean displacement field of a result, one row per tracer.
The default groups:
box: Tracer, Lagrangian, Displacement, ValidRealizations (10 columns), and OutsideBox (11) when limits were given to reconstructBox, a periodic box included, where it is all 0;
lightcone: TracerSky, LagrangianSky, Tracer, Lagrangian, Displacement, ValidRealizations, Selection (18 columns, 19 with outsideDistanceCut);
Id first (one more column) when Result::ids is not empty.
With groups given explicitly, the id column is written only when Id is listed. readDisplacementMean needs Tracer, Displacement and ValidRealizations, and TracerSky in a lightcone.
Precision: in ASCII, ‘D’ values are written with 9 significant digits, so a position or displacement read back equals the one written within that rounding, and the keywords BOXXLO to BOXZHI of a non-periodic box are rounded outward to that precision, so the tracers as written lie within the limits as written; a periodic box keeps its limits exactly. FITS stores the doubles themselves. The profile and the distance table of a lightcone, described below, take 17 digits in ASCII and read back identical.
Keywords: those of the reconstruction, listed with writeDisplacementComplete, among them PERIODIC = 1, NTRWRAP and NRNWRAP for a periodic box (the counts each omitted when 0), and MPSPART = 1 and DISTPART = 1 when the profile and the table are written. In FITS the table is named DISPLACEMENTS.
A lightcone file also holds the mps profile and the distance table of the result, in the layout of writeDisplacementComplete, each with its own PRODUCT, mean displacements mps profile and mean displacements distance table, when lightconeTables is true and the result holds them (a Cartesian result without a distance table has none); readDisplacementMean returns them.
- Parameters:
file – the file to write; its extension sets the format.
result – a box or lightcone result.
groups – the groups to write, in this order; empty for the default of the result’s geometry.
lightconeTables – false to leave out the profile and the table of a lightcone result; no effect on a box result, which has neither.
- Throws:
Error – if a group is repeated or does not apply to the geometry (OutsideBox to a lightcone, or a lightcone group to a box), or if a field a group reads does not have the size of its layout; whatever the groups, if ids is neither empty nor one per object or holds a value twice, if result.nRealizations and result.config.nRealizations differ, if result.nRealizationsMean is 0, or above 1 while result.nRealizations is not 1, if selection.boxLimits is set and box is empty or differs from it, if the result is periodic and is not a box result, has no selection.boxLimits or flags a tracer in outsideBox, if periodic and selection.periodic differ, if the profile written does not have one mps and one count per node; or as io::write.
-
enum class otswap::io::DisplacementGroup¶
The column groups of writeDisplacementMean.
Values:
-
enumerator Id¶
id (K): Result::ids, or the row of the tracer in the input, from 0, when it is empty
-
enumerator TracerSky¶
tracRA, tracDec (deg), tracRed: the observed tracer; lightcone only
-
enumerator LagrangianSky¶
lagrRA, lagrDec (deg), lagrRed: Result::lagrangianSky; lightcone only
-
enumerator Tracer¶
tracX, tracY, tracZ: Result::tracers
-
enumerator Lagrangian¶
lagrX, lagrY, lagrZ: Result::lagrangian
-
enumerator Displacement¶
displX, displY, displZ: Result::meanDisplacement
-
enumerator ValidRealizations¶
nValidRec (J): Result::validRealizations
-
enumerator Selection¶
outsideRedshiftCut, outsideMask (J, 0 or 1), and outsideDistanceCut for every LightconeCartesian result, with or without a cut, or one that flags a tracer in it; lightcone only
-
enumerator OutsideBox¶
outsideBox (J, 0 or 1): Result::outsideBox; box only, all 0 in a periodic box
-
enumerator Id¶
-
Result otswap::io::readDisplacementMean(const std::string &file)¶
Read a file written by writeDisplacementMean into a Result holding the mean as its only realization.
The geometry is the file’s GEOMETRY, and its keywords are read as readDisplacementComplete reads them: the config (but log, which is &std::clog, and nRealizations, which is 1), filteredNside, selection, mps and box. The Result has nRealizations = 1; displacement and meanDisplacement both hold the mean displacement; valid is 1 where the tracer has at least one valid realization; validRealizations is the file’s count; nRealizationsMean is NRECMEAN when the file holds it, NREC otherwise, the number of realizations averaged.
Required columns: tracX..tracZ, displX..displZ and nValidRec, and in a lightcone tracRA, tracDec and tracRed. The others are read when the file holds them: id (ids, empty when the IDs are 0..nObjects-1), lagrX..lagrZ (lagrangian), lagrRA..lagrRed (lagrangianSky, in a lightcone), outsideRedshiftCut, outsideMask and outsideDistanceCut (lightcone), outsideBox (box). Without them a flag is all 0, and lagrangian, lagrangianSky and lagrangianDistance are computed from tracers + meanDisplacement as recomputeMeans does. The profile and the table are read when the main table declares them (MPSPART, DISTPART), from the HDUs or twin files of writeDisplacementMean; a file of otswap 0.2 has neither. elapsedSeconds is 0.
The values read are those written, within the precision of writeDisplacementMean; the right ascension is in [0, 360), as the writer folds it. recomputeMeans on the Result read sets validRealizations to 0 or 1, the count of its one realization.
- Parameters:
file – a mean displacement file; its extension sets the format.
- Throws:
Error – if the file cannot be read (as io::read); if its PRODUCT is not that of writeDisplacementMean; if a keyword is malformed or a required column is missing; if it does not hold NOBJECTS rows; if a flag is neither 0 nor 1, a count of valid realizations lies outside [0, nRealizationsMean], or an ID is repeated; if the file records the tracer counts of the selection (NTRAC) and one disagrees with the flags read; if a box file declares a profile or a table; if a declared profile or table is missing, is not the part written, by its PRODUCT, or is malformed. Every message names the file, and a row by its ASCII line or FITS row, counted from 1.
- Returns:
the mean as a result of one realization.
Complete displacements¶
-
void otswap::io::writeDisplacementComplete(const std::string &file, const Result &result, bool lightconeTables = true)¶
Write every realization of a result, losslessly, with what a reader needs to rebuild it: one row per realization and tracer, ordered [realization][object], the order of Result::displacement; and, for a lightcone, its mps(z) profile and its distance table.
Columns: realization (J, from 0); id (K, the object’s ID as in writeDisplacementMean); for a lightcone, tracRA, tracDec (deg) and tracRed (Result::tracersSky, the right ascension as given, not folded into [0, 360)); tracX..tracZ (Result::tracers); displX..displZ (Result::displacement); valid (J); outsideRedshiftCut, outsideMask, outsideBox (J, 0 or 1, in both geometries); outsideDistanceCut (J, 0 or 1) last, for every LightconeCartesian result, with or without a cut, or one that flags a tracer in outsideDistanceCut, and absent otherwise. The columns of the tracer, id and flags are repeated in every realization.
‘D’ values are written with 17 significant digits in ASCII, and as they are in FITS, so every double reads back identical, NaN rows as NaN, in both formats. A Result filled from such a file, with recomputeMeans, has the reconstruction’s meanDisplacement, validRealizations and lagrangian bit for bit, and its lagrangianSky given the distance table. readDisplacementComplete reads the file back into a Result.
Keywords, those of writeDisplacementMean too: NREC and, when Result::nRealizationsMean is above 1, NRECMEAN, the realizations averaged (NREC is then 1); SEED (the seed used), CONVERG, CELLSIZE, REJCROSS (0 or 1), CFMAXPIX, VERBOSE (silent, normal or detailed): the configuration; MPS for a box; BOXXLO, BOXXHI, BOXYLO, BOXYHI, BOXZLO, BOXZHI, Result::box when it is set, and BOXLIM = 1 when it holds the limits given to reconstructBox; PERIODIC = 1 when the box is periodic (the keyword is then written with BOXLIM, and absent for a box that is not periodic); ZCUTMIN and ZCUTMAX for the finite bounds of a redshift cut, DCUTMIN and DCUTMAX for those of a distance cut, MASK = 1 when a mask selected the objects, FILTNSID and MAXPIXCR when a mask filter was applied (CFMAXPIX and MAXPIXCR are thresholds of rejectMaskCrossings, which states the rule); NTRAC, NTRCUT, NTRDCUT, NTRMASK, NTRBOTH, NTRBOX, NRAND, NRNCUT, NRNDCUT, NRNMASK, NRNBOTH, NRNBOX, NTRWRAP, NRNWRAP, NDISPL and NDISPCR, the counts of Result::selection, each when it is not 0. Doubles are written as the shortest decimal that reads back as the same value. Then MPSPART = 1 and DISTPART = 1 when the profile and the table are written.
The profile, columns redshift (or distance, for a profile in distance), MPS and nTracers (J), with the keywords ZMIN, ZMAX (or DISTMIN, DISTMAX) and MPSREPR of writeMpsProfile, and the table, columns redshift, distance and, when the table has one, growthRate, with the keywords ZMIN and ZMAX, its ends, are written with 17 digits in ASCII, each with its own PRODUCT, complete displacements mps profile and complete displacements distance table. In FITS they are the HDUs MPSPROF and DISTANCE, after the main table DISPLACEMENTS. In ASCII they are twin files next to the file, the name with .mps and .distances inserted before the text after its last ‘.’ (run.dat gives run.mps.dat and run.distances.dat), or appended when the name has no ‘.’. A file renamed needs its twins renamed by the same rule. Existing files of those names are overwritten: the twin run.mps.dat replaces a writeMpsProfile file of that name, and is replaced by it when that is written later. Each is written when lightconeTables is true, the result is a lightcone and holds it: the profile when mpsProfile is not empty, the table when distances is not null.
- Parameters:
file – the file to write; its extension sets the format.
result – a box or lightcone result.
lightconeTables – false to leave out the profile and the table of a lightcone result; no effect on a box result, which has neither.
- Throws:
Error – if a field read does not have the size of its layout (tracersSky included, for a lightcone), if ids is neither empty nor one per object or holds a value twice, if result.nRealizations and result.config.nRealizations differ, if result.nRealizationsMean is 0, or above 1 while result.nRealizations is not 1, if selection.boxLimits is set and box is empty or differs from it, if the result is periodic and is not a box result, has no selection.boxLimits or flags a tracer in outsideBox, if periodic and selection.periodic differ, if the profile written does not have one mps and one count per node, or as io::write.
-
Result otswap::io::readDisplacementComplete(const std::string &file)¶
Read a file written by writeDisplacementComplete back into a Result.
Read as written: the geometry, ids, nRealizationsMean (NRECMEAN, 1 when absent), config (but log, which is &std::clog; the fields a file does not record take the current defaults), tracers, tracersSky (degrees to radians), displacement, valid, the flags (outsideDistanceCut all 0 when its column is absent), filteredNside, selection, mps, box, periodic, mpsProfile, and the distance table, as a new table equal to the one written. Recomputed with recomputeMeans: validRealizations, meanDisplacement, lagrangian, lagrangianSky and lagrangianDistance. elapsedSeconds is 0, and cellSide NaN. ids is empty when the file’s IDs are 0..nObjects-1. The columns of the tracer, id and flags are taken from realization 0.
Every double reads back identical, and so does every field above but tracersSky, whose right ascension and declination are equal within the rounding of the conversion to degrees and back; NaN reads back as NaN, with its sign and payload in FITS only. realSpaceLightcone on the Result read gives the catalogue of the reconstruction bit for bit, but for its right ascension and declination, equal within that rounding.
The profile and the table are read when the main table declares them (MPSPART, DISTPART): in FITS from the HDUs MPSPROF and DISTANCE, in ASCII from the twin files named by the rule of writeDisplacementComplete, from the name of the file read. They are left empty when it does not: for a file written with lightconeTables false, and for a file of otswap 0.1, whose Result has no tracersSky either, and whose index column is read as the IDs. A box file of otswap 0.1 gets the bounding box of its tracers as Result::box, the box its reconstruction used. The columns lagrX..lagrZ of a file of otswap 0.1 are not read.
- Parameters:
file – a complete displacement file; its extension sets the format.
- Throws:
Error – if the file cannot be read (as io::read); if its PRODUCT is not that of writeDisplacementComplete; if a keyword or a column its layout requires is missing or malformed; if the rows are not NOBJECTS x NREC, ordered in blocks of realization 0, 1, and so on; if a flag or valid entry is neither 0 nor 1, or an ID is repeated; if the file records the tracer counts of the selection (NTRAC) and one disagrees with the flags; if a box file declares a profile or a table; if a declared profile or table is missing, the message naming the file and the part, or is not the part written, by its PRODUCT, or is malformed. Every message names the file, and a row by its ASCII line or FITS row, counted from 1.
- Returns:
the result, as writeDisplacementComplete received it but for the differences above (tracersSky, elapsedSeconds, cellSide).
Real-space catalogue¶
-
void otswap::io::writeRealSpaceCatalog(const std::string &file, const RealSpaceCatalog &catalog, const std::vector<CatalogGroup> &groups = {})¶
Write a catalogue moved to real space, one row per tracer.
The default groups:
lightcone: Sky, Cartesian, ValidRealizations, Neighbours, Status (10 columns);
box: Cartesian, ValidRealizations, Neighbours, Status (7 columns);
Id first (one more column) when RealSpaceCatalog::ids is not empty.
The shift and the factor are written when Shift is listed in
groups. The columns tracX..tracZ and tracRA..tracRed hold the corrected positions here, where the displacement files hold the observed ones; a lightcone tracer moves along its line of sight, so tracRA and tracDec keep the observed angles. The file has no reader of its own: io::read reads its columns by name.‘D’ values are written with 9 significant digits in ASCII. Keywords: SIGMA, WEIGHTED (0 or 1); NEXTRAP for a lightcone; AXIS, ZBOX and BIAS for a box. A periodic box has no PERIODIC keyword here; its corrected coordinate along the axis is wrapped into the box.
- Parameters:
file – the file to write; its extension sets the format.
catalog – a box or lightcone catalogue.
groups – the groups to write, in this order; empty for the default of the catalogue’s geometry.
- Throws:
Error – if a group is repeated, if Sky is given for a box, if a field a group reads does not have the size of its layout, if ids is neither empty nor one per object or holds a value twice, or as io::write.
-
enum class otswap::io::CatalogGroup¶
The column groups of writeRealSpaceCatalog.
Values:
-
enumerator Id¶
id (K): RealSpaceCatalog::ids, or the row of the tracer in the input, from 0, when it is empty
-
enumerator Sky¶
tracRA, tracDec (deg), tracRed: RealSpaceCatalog::sky, the corrected position; lightcone only
-
enumerator Cartesian¶
tracX, tracY, tracZ: RealSpaceCatalog::cartesian, the corrected position
-
enumerator ValidRealizations¶
nValidRec (J)
-
enumerator Neighbours¶
nNeighbours, nRealizationsAveraged (J)
-
enumerator Shift¶
shift (coordinate units), rsdFactor: RealSpaceCatalog::shift, factor
-
enumerator Status¶
status (J): RealSpaceCatalog::status, the value of CorrectionStatus (0 to 3)
-
enumerator Id¶
Mean particle separation profile¶
-
void otswap::io::writeMpsProfile(const std::string &file, const MpsProfile &profile)¶
Write a mean particle separation profile: redshift (the bin centre), MPS, nTracers (J), one row per bin. Keywords: ZMIN, ZMAX, MPSREPR (the representative value). A profile in distance has the column distance (the bin centre, in coordinate units) in place of redshift, and the keywords DISTMIN and DISTMAX in place of ZMIN and ZMAX. MpsProfile::at gives the profile anywhere. The file has no reader of its own: io::read reads its columns by name.
Parameter files¶
otswap::io::ParameterFile, in otswap/ParameterFile.h, reads a
text file of parameters, one key = value per line. It is C++ only. For
example:
# a reconstruction
n_realizations = 8
columns = 0 1 2 # three elements
output = "../my output/run 1.fits"
delimiter = \t
Keys hold letters, digits and
_, do not start with a digit, and are case-sensitive. Each key is set at most once in a file.Comments start with
#and run to the end of the line, on a line of their own or after a value. Blank lines are skipped.Values are lists of elements separated by spaces or tabs. A scalar parameter needs exactly one element; a list parameter takes them all.
key =sets an empty list.Double quotes group an element that holds spaces, tabs or
#, as inoutputabove, and do not change its meaning:"5"is 5 and"true"is true.""is one empty element. There is no escape, so an element cannot hold a double quote, and a quote must not be glued to other text. Single quotes, braces and commas are ordinary characters:{0, 1, 2}is the three elements{0,,1,and2}.Everything after the first
=is the value, further=signs included.Types: strings;
trueorfalse; integers written in decimal, with an optional-and no+, so1e3and5.0are not integers; floating-point numbers, finite, with an optional exponent (2.194e-9,.5,1.,5), with.as the decimal separator whatever the locale; single characters,\tfor a tab; and lists of each.Windows line endings and a UTF-8 byte-order mark at the start of the file are accepted.
Every error names the file and, where there is one, the line and the key, as
run.ini:7: key 'n_realizations': '8.0' is not an integer. A syntax error
anywhere in the file is reported when the file is read, before any parameter
is; a value of the wrong type when that parameter is read. A program can
also list the keys it never read, with their lines (unread()), to refuse
unknown ones.