Documentation
¶
Overview ¶
Package off provides classes that write OFF files OFF files store TES pulses projected into a linear basis OFF files have a JSON header followed by a single newline after the header records are written sequentially in little endian format bytes type meaning 0-3 int32 recordSamples (could be calculated from nearest neighbor pulses in princple) 4-7 int32 recordPreSamples (could be calculated from nearest neighbor pulses in princple) 8-15 int64 framecount 16-23 int64 timestamp from time.Time.UnixNano() 24-27 float32 pretriggerMean (from raw data, not from modeled pulse, really shouldn't be neccesary, just in case for now!) 28-31 float32 residualStdDev (in raw data space, not Mahalanobis distance) 32-Z float32 the NumberOfBases model coefficients of the pulse projected in to the model Z = 31+4*NumberOfBases
Index ¶
- Constants
- type ArrayJsoner
- type CreationInfo
- type ModelInfo
- type PixelInfo
- type TimeDivisionMultiplexingInfo
- type Writer
- func (w Writer) Close()
- func (w *Writer) CreateFile() error
- func (w Writer) Flush()
- func (w *Writer) HeaderWritten() bool
- func (w *Writer) RecordsWritten() int
- func (w *Writer) WriteHeader() error
- func (w *Writer) WriteRecord(recordSamples int32, recordPreSamples int32, framecount int64, timestamp int64, ...) error
Constants ¶
const BUFIOSIZE = 65536
The buffer size (bytes) of the bufio.Writer that buffers disk output
const FLUSHINTERVAL = 3 * time.Second
Flush the ouputfile regularly at this interval
const WRITECHANCAPACITY = 1000
The capacity of unprocessed pulse records before even the "asynchronous" writes will block.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrayJsoner ¶
ArrayJsoner aids in formatting arrays for writing to JSON
func NewArrayJsoner ¶
func NewArrayJsoner(array *mat.Dense) *ArrayJsoner
NewArrayJsoner creates an ArrayJsoner from a mat.Dense
type CreationInfo ¶
type CreationInfo struct { DastardVersion string GitHash string SourceName string CreationTime time.Time }
CreationInfo stores info related to file creation for printing to the file header, aids with json formatting
type ModelInfo ¶
type ModelInfo struct { Projectors ArrayJsoner Basis ArrayJsoner Description string // contains filtered or unexported fields }
ModelInfo stores info related to the model (aka basis, aka projectors) for printing to the file header, aids with json formatting
type TimeDivisionMultiplexingInfo ¶
type TimeDivisionMultiplexingInfo struct { NumberOfRows int NumberOfColumns int NumberOfChans int SubframeDivisions int ColumnNum int RowNum int SubframeOffset int }
TimeDivisionMultiplexingInfo stores info related to tdm readout for printing to the file header, aids with json formatting
type Writer ¶
type Writer struct { ChannelIndex int ChannelName string ChannelNumberMatchingName int MaxPresamples int MaxSamples int FramePeriodSeconds float64 FileFormat string FileFormatVersion string NumberOfBases int ModelInfo ModelInfo CreationInfo CreationInfo ReadoutInfo TimeDivisionMultiplexingInfo PixelInfo PixelInfo // contains filtered or unexported fields }
Writer writes OFF files
func NewWriter ¶
func NewWriter(fileName string, ChannelIndex int, ChannelName string, ChannelNumberMatchingName int, MaxPresamples int, MaxSamples int, FramePeriodSeconds float64, Projectors *mat.Dense, Basis *mat.Dense, ModelDescription string, DastardVersion string, GitHash string, SourceName string, ReadoutInfo TimeDivisionMultiplexingInfo, pixelInfo PixelInfo) *Writer
NewWriter creates a new OFF writer. No file is created until the first call to WriteRecord
func (Writer) Close ¶
func (w Writer) Close()
Close closes the file, it flushes the bufio.Writer first
func (*Writer) CreateFile ¶
CreateFile creates a file at w.FileName must be called before WriteHeader or WriteRecord
func (*Writer) HeaderWritten ¶
HeaderWritten returns true if header has been written.
func (*Writer) RecordsWritten ¶
RecordsWritten return the nunber of records written.
func (*Writer) WriteHeader ¶
WriteHeader writes a header to the file