Constructor
new BlueHeader(buf, optionsnullable)
Constructor for a BlueHeader that extracts parameters from the 512-byte Bluefile binary header. If the data segment of the bluefile is also included in the provided buffer it will be accessible as well via the dview property.
Properties:
Name | Type | Description |
---|---|---|
buf |
ArrayBuffer
|
|
options |
object
|
|
version |
String
|
the header version extracted from the file, always 'BLUE' |
headrep |
String
|
endianness of header 'IEEE' or 'EEEI' |
datarep |
String
|
endianness of data 'IEEE' or 'EEEI' |
ext_start |
Number
|
byte offset for extended header binary data |
ext_size |
Number
|
byte size for extended header data |
type |
Number
|
the BLUEFILE type (1000 = 1-D data, 2000 = 2-D data) |
class |
Number
|
the BLUEFILE class (i.e. type/1000) |
format |
String
|
the BLUEFILE format, the format is a two character diagraph, such as SF. |
timecode |
Number
|
absolute time reference for the file (in seconds since Jan 1st 1950) |
xstart |
Number
|
relative offset for the first sample on the x-axis |
xdelta |
Number
|
delta between points on the x-axis |
xunits |
Number
|
the unitcode for the x-axis (see m.UNITS) |
ystart |
Number
|
relative offset for the first sample on the y-axis |
ydelta |
Number
|
delta between points on the y-axis |
yunits |
Number
|
the unitcode for the y-axis (see m.UNITS) |
subsize |
Number
|
the number of columns for a 2-D data file |
data_start |
Number
|
byte offset for data |
data_size |
Number
|
byte size for data |
ext_header |
Object
|
extracted extended header keywords |
spa |
Number
|
scalars per atom |
bps |
Number
|
bytes per scalar |
bpa |
Number
|
bytes per atom |
ape |
Number
|
atoms per element |
bpe |
Number
|
bytes per element |
size |
Number
|
number of elements in dview |
dview |
DataView
|
a Data |
- Source:
- See:
Parameters:
Name | Type | Attributes | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
buf |
ArrayBuffer
|
array
|
An existing ArrayBuffer of Bluefile data. |
|||||||||||
options |
object
|
<nullable> |
options that affect how the bluefile is read
|
Members
(static) ARRAY_BUFFER_ENDIANNESS :string
Static member that indicates the endianness of the system, BlueHeader.ARRAY_BUFFER_ENDIANNESS.
- Source:
Type:
-
string
Methods
(private) createArray(buf, offset, length) → {array}
Internal method to create typed array for the data based on the format extracted from the header.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
buf |
||
offset |
||
length |
Returns:
- Type:
-
array
(private) setData(buf, offset, data_end, littleEndiannullable)
Internal method that sets the dview up based off the provided buffer and fields extracted from the header.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
buf |
ArrayBuffer
|
array
|
||
offset |
number
|
||
data_end |
number
|
||
littleEndian |
boolean
|
<nullable> |
(private) setHeader()
Internal method to parse the 512 byte header and unpack the extended header keywords
- Source:
(private) unpack_keywords(buf, lbuf, offset, littleEndian) → {object|Array}
Internal method that unpacks the extended header keywords into either a object (i.e. dictionary) or a list of key-value pairs depending on this.options.ext_header_type.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
buf |
ArrayBuffer
|
Buffer where the keywords are located |
lbuf |
number
|
Size of the extended header |
offset |
number
|
Offset from the extended header |
littleEndian |
boolean
|
Whether or not to parse as little endian |
Returns:
- Type:
-
object
|Array
Parsed keywords as an object from the header