BlueHeader

BlueHeader

Bluefiles are a binary format directly supported by SigPlot. A Bluefile consists of a 512-byte header followed by binary data.

For more information on BLUEFILES, please visit http://nextmidas.techma.com/nm/htdocs/usersguide/BlueFiles.html

Offset Name Size Type Description
0 version 4 char[4] Header version
4 head_rep 4 char[4] Header representation
8 data_rep 4 char[4] Data representation
12 detached 4 int_4 Detached header
16 protected 4 int_4 Protected from overwrite
20 pipe 4 int_4 Pipe mode (N/A)
24 ext_start 4 int_4 Extended header start, in 512-byte blocks
28 ext_size 4 int_4 Extended header size in bytes
32 data_start 8 real_8 Data start in bytes
40 data_size 8 real_8 Data size in bytes
48 type 4 int_4 File type code
52 format 2 char[2] Data format code
54 flagmask 2 int_2 16-bit flagmask (1=flagbit)
56 timecode 8 real_8 Time code field
64 inlet 2 int_2 Inlet owner
66 outlets 2 int_2 Number of outlets
68 outmask 4 int_4 Outlet async mask
72 pipeloc 4 int_4 Pipe location
76 pipesize 4 int_4 Pipe size in bytes
80 in_byte 8 real_8 Next input byte
88 out_byte 8 real_8 Next out byte (cumulative)
96 outbytes 64 real_8[8] Next out byte (each outlet)
160 keylength 4 int_4 Length of keyword string
164 keywords 92 char[92] User defined keyword string
256 Adjunct 256 char[256] Type-specific adjunct union (See below for 1000 and 2000 type bluefiles)

Type-1000 Adjunct

Offset Name Size Type Description
0 xstart 8 real_8 Abscissa value for first sample
8 xdelta 8 real_8 Abscissa interval between samples
16 xunits 4 int_4 Units for abscissa values

Type-2000 Adjunct

Offset Name Size Type Description
0 xstart 8 real_8 Frame (column) starting value
8 xdelta 8 real_8 Increment between samples in frame
16 xunits 4 int_4 Frame (column) units
20 subsize 4 int_4 Number of data points per frame (row)
24 ystart 8 real_8 Abscissa (row) start
32 ydelta 8 real_8 Increment between frames
36 yunits 4 int_4 Abscissa (row) unit code

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

Name Type Attributes Default Description
ext_header_type string <optional>
"dict"

if the BlueFile contains extended header keywords, extract them either as a dictionary ("dict", "json", {}, "XMTable", "JSON", "DICT") or as a list of key value pairs. The extended header keywords will be accessible on the hdr.ext_header property after the file has been read.

See http://nextmidas.techma.com/nm/nxm/sys/docs/MidasBlueFileFormat.pdf for more details on header properties.

Members

(static) _SPA

Mapping from character to

Source:

(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.

Author:
  • Sean Sullivan https://github.com/desean1625
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