Functions
getsize (filename, header_size, rowsize) |
The default method to determine the size of the binary file |
Classes
BinaryFile (path, dtype[, offsets, …]) |
A file object to handle the reading of columns of data from a binary file. |
nbodykit.io.binary.
BinaryFile
(path, dtype, offsets=None, header_size=0, size=None)[source]¶A file object to handle the reading of columns of data from a binary file.
Warning
This assumes the data is stored in a column-major format
Parameters: |
|
---|
Attributes
columns |
A list of the names of the columns in the file. |
dtype |
A numpy.dtype object holding the data types of each column in the file. |
ncol |
The number of data columns in the file. |
shape |
The shape of the file, which defaults to (size, ) |
size |
The size of the file, i.e., number of rows |
Methods
asarray () |
Return a view of the file, where the fields of the |
get_dask (column[, blocksize]) |
Return the specified column as a dask array, which |
keys () |
Aliased function to return columns |
read (columns, start, stop[, step]) |
Read the specified column(s) over the given range |
read
(columns, start, stop, step=1)[source]¶Read the specified column(s) over the given range
‘start’ and ‘stop’ should be between 0 and size
,
which is the total size of the binary file (in particles)
Parameters: | |
---|---|
Returns: | structured array holding the requested columns over the specified range of rows |
Return type: |
nbodykit.io.binary.
getsize
(filename, header_size, rowsize)[source]¶The default method to determine the size of the binary file
The “size” is defined as the number of rows, where each row has of size of rowsize in bytes.
Notes
Raises: | ValueError : – If the function determines a fractional number of rows |
---|---|
Parameters: |