Documentation ¶
Overview ¶
Package sdk3 exposes control of Andor cameras in Go via their SDK, v3.
Index ¶
- Constants
- Variables
- func DeviceCount() (int, error)
- func Error(code int) error
- func FinalizeLibrary()
- func GetBool(handle int, feature string) (bool, error)
- func GetEnumCount(handle int, feature string) (int, error)
- func GetEnumIndex(handle int, feature string) (int, error)
- func GetEnumString(handle int, feature string) (string, error)
- func GetEnumStringByIndex(handle int, feature string, idx int) (string, error)
- func GetEnumStrings(handle int, feature string) ([]string, error)
- func GetFloat(handle int, feature string) (float64, error)
- func GetFloatMax(handle int, feature string) (float64, error)
- func GetFloatMin(handle int, feature string) (float64, error)
- func GetInt(handle int, feature string) (int, error)
- func GetIntMax(handle int, feature string) (int, error)
- func GetIntMin(handle int, feature string) (int, error)
- func GetString(handle int, feature string) (string, error)
- func GetStringMaxLength(handle int, feature string) (int, error)
- func InitializeLibrary() error
- func IssueCommand(handle int, feature string) error
- func SetBool(handle int, feature string, tru bool) error
- func SetEnumIndex(handle int, feature string, idx int) error
- func SetEnumString(handle int, feature, value string) error
- func SetFloat(handle int, feature string, value float64) error
- func SetInt(handle int, feature string, val int64) error
- func SetString(handle int, feature, value string) error
- func SoftwareVersion() (string, error)
- func UnpadBuffer(buf []byte, aoistride, aoiwidth, aoiheight int) []byte
- type Camera
- func (c *Camera) Allocate() error
- func (c *Camera) Buffer() []byte
- func (c *Camera) Burst(frames int, fps float64, ch chan<- image.Image) error
- func (c *Camera) Close() error
- func (c *Camera) CollectHeaderMetadata() []fitsio.Card
- func (c *Camera) Command(cmd string) error
- func (c *Camera) Configure(settings map[string]interface{}) error
- func (c *Camera) Features() (map[string]string, error)
- func (c *Camera) Flush() error
- func (c *Camera) GetAOI() (camera.AOI, error)
- func (c *Camera) GetAOIHeight() (int, error)
- func (c *Camera) GetAOILeft() (int, error)
- func (c *Camera) GetAOIStride() (int, error)
- func (c *Camera) GetAOITop() (int, error)
- func (c *Camera) GetAOIWidth() (int, error)
- func (c *Camera) GetBinning() (camera.Binning, error)
- func (c *Camera) GetCooling() (bool, error)
- func (c *Camera) GetDriverVersion() (string, error)
- func (c *Camera) GetExposureTime() (time.Duration, error)
- func (c *Camera) GetFan() (bool, error)
- func (c *Camera) GetFeature(feature string) (interface{}, error)
- func (c *Camera) GetFeatureInfo(feature string) (map[string]interface{}, error)
- func (c *Camera) GetFirmwareVersion() (string, error)
- func (c *Camera) GetFrame() (image.Image, error)
- func (c *Camera) GetFrameSize() (int, int, error)
- func (c *Camera) GetModel() (string, error)
- func (c *Camera) GetSDKVersion() (string, error)
- func (c *Camera) GetSensorHeight() (int, error)
- func (c *Camera) GetSensorWidth() (int, error)
- func (c *Camera) GetSerialNumber() (string, error)
- func (c *Camera) GetTemperature() (float64, error)
- func (c *Camera) GetTemperatureSetpoint() (string, error)
- func (c *Camera) GetTemperatureSetpoints() ([]string, error)
- func (c *Camera) GetTemperatureStatus() (string, error)
- func (c *Camera) ImageSizeBytes() (int, error)
- func (c *Camera) QueueBuffer() error
- func (c *Camera) SetAOI(aoi camera.AOI) error
- func (c *Camera) SetBinning(b camera.Binning) error
- func (c *Camera) SetCooling(b bool) error
- func (c *Camera) SetExposureTime(d time.Duration) error
- func (c *Camera) SetFan(b bool) error
- func (c *Camera) SetFeature(feature string, v interface{}) error
- func (c *Camera) SetTemperatureSetpoint(s string) error
- func (c *Camera) WaitBuffer(timeout time.Duration) error
- type DRVError
- type ErrFeatureNotFound
Constants ¶
const ( // LengthOfUndefinedBuffers is how large a buffer to allocate for a Wchar // string when we have no way of knowing ahead of time how big it is // it is measured in Wchars LengthOfUndefinedBuffers = 255 // WRAPVER is the andor wrapper code version. // Increment this when pkg sdk3 is updated. WRAPVER = 11 // NeoBufferSize is the size of the buffer on the Andor Neo camera itself (4GB) NeoBufferSize = 4e9 // CLBaseSpeed is the transfer rate in B/s of base speed camera link, // used by the Andor Neo camera. CLBaseSpeed = 255e6 )
Variables ¶
var ( // ErrBufferNotOnQueue is generated before a catastrophic side effect is triggered ErrBufferNotOnQueue = errors.New("no buffer placed on queue, this error saves you from memory corruption") // ErrCodes is a map of error codes (ints) to error strings ErrCodes = map[int]string{ 0: "AT_SUCCESS", 1: "AT_ERR_NOT_INITIALISED", 2: "AT_ERR_NOT_IMPLEMENTED", 3: "AT_ERR_READONLY", 4: "AT_ERR_NOT_READABLE", 5: "AT_ERR_NOT_WRITABLE", 6: "AT_ERR_OUT_OF_RANGE", 7: "AT_ERR_INDEX_NOT_AVAILABLE", 8: "AT_ERR_INDEX_NOT_IMPLEMENTED", 9: "AT_ERR_EXCEEDED_MAX_STRING_LENGTH", 10: "AT_ERR_CONNECTION", 11: "AT_ERR_NO_DATA", 12: "AT_ERR_INVALID_HANDLE", 13: "AT_ERR_TIMED_OUT", 14: "AT_ERR_BUFFER_FULL", 15: "AT_ERR_INVALID_SIZE", 16: "AT_ERR_INVALID_ALIGNMENT", 17: "AT_ERR_COMM", 18: "AT_ERR_STRING_NOT_AVAILABLE", 19: "AT_ERR_STRING_NOT_IMPLEMENTED", 20: "AT_ERR_NULL_FEATURE", 21: "AT_ERR_NULL_HANDLE", 22: "AT_ERR_NULL_IMPLEMENTED_VAR", 23: "AT_ERR_NULL_READABLE_VAR", 24: "AT_ERR_NULL_READONLY_VAR", 25: "AT_ERR_NULL_WRITABLE_VAR", 26: "AT_ERR_NULL_MIN_VALUE", 27: "AT_ERR_NULL_MAX_VALUE", 28: "AT_ERR_NULL_VALUE", 29: "AT_ERR_NULL_STRING", 30: "AT_ERR_NULL_COUNT_VAR", 31: "AT_ERR_NULL_IS_AVAILABLE_VAR", 32: "AT_ERR_NULL_MAX_STRING_LENGTH", 33: "ATT_ERR_NULL_EV_CALLBACK", 34: "AT_ERR_NULL_QUEUE_PTR", 35: "AT_ERR_NULL_WAIT_PTR", 36: "AT_ERR_NULL_PTR_SIZE", 37: "AT_ERR_NO_MEMORY", 38: "AT_ERR_DEVICE_IN_USE", 39: "AT_ERR_DEVICE_NOT_FOUND", 100: "AT_ERR_HARDWARE_OVERFLOW", } )
var ( // Features maps features to "types" without using the types pkg, due to C enums Features = map[string]string{ "AccumulatedCount": "int", "AOIHBin": "int", "AOIVBin": "int", "AOILeft": "int", "AOITop": "int", "AOIStride": "int", "AOIHeight": "int", "AOIWidth": "int", "BaselineLevel": "int", "BufferOverflowEvent": "int", "DeviceCount": "int", "DeviceVideoIndex": "int", "EventsMissedEvent": "int", "ExposureStartEvent": "int", "ExposureEndEvent": "int", "FrameCount": "int", "ImageSizeBytes": "int", "LUTIndex": "int", "LUTValue": "int", "RowNExposureEndEvent": "int", "RowNExposureStartEvent": "int", "SensorHeight": "int", "SensorWidth": "int", "TimestampClock": "int", "TimestampClockFrequency": "int", "AlternatingReadoutDirection": "bool", "CameraAcquiring": "bool", "EventEnable": "bool", "FastAOIFrameRateEnable": "bool", "FullAOIControl": "bool", "IOInvert": "bool", "MetadataEnable": "bool", "MetadataFrame": "bool", "MetadataTimestamp": "bool", "Overlap": "bool", "RollingShutterGlobalClear": "bool", "ScanSpeedControlEnable": "bool", "SensorCooling": "bool", "SpuriousNoiseFilter": "bool", "StaticBlemishCorrection": "bool", "SynchronousTriggering": "bool", "VerticallyCentreAOI": "bool", "AcquisitionStart": "command", "AcquisitionStop": "command", "CameraDump": "command", "SoftwareTrigger": "command", "TimestampClockReset": "command", "BytesPerPixel": "float", "ExposureTime": "float", "FrameRate": "float", "LineScanSpeed": "float", "MaxInterfaceTransferRate": "float", "PixelHeight": "float", "PixelWidth": "float", "ReadoutTime": "float", "SensorTemperature": "float", "AOIBinning": "enum", "AOILayout": "enum", "BitDepth": "enum", "CycleMode": "enum", "ElectronicShutteringMode": "enum", "FanSpeed": "enum", "PixelEncoding": "enum", "PixelReadoutRate": "enum", "TemperatureControl": "enum", "TemperatureStatus": "enum", "TriggerMode": "enum", "SensorReadoutMode": "enum", "SimplePreAmpGainControl": "enum", "CameraModel": "string", "CameraName": "string", "ControllerID": "string", "DriverVersion": "string", "FirmwareVersion": "string", "InterfaceType": "string", "SerialNumber": "string", } )
Functions ¶
func DeviceCount ¶
DeviceCount returns the number of devices (cameras) found by the SDK InitializeLibrary must be called first
func Error ¶
Error returns nil on beneign error codes or returns an error object on non-beneign ones
func FinalizeLibrary ¶
func FinalizeLibrary()
FinalizeLibrary calls the function of the same name in the Andor SDK
func GetEnumCount ¶
GetEnumCount gets the number of items in the enum behind a feature
func GetEnumIndex ¶
GetEnumIndex gets the currently selected index into the enum behind feature
func GetEnumString ¶
GetEnumString gets the string value of an enum. this function is just a convenience wrapper around GetEnumIndex and GetEnumStringByIndex
func GetEnumStringByIndex ¶
GetEnumStringByIndex gets the string value of an enum at a given index
func GetEnumStrings ¶
GetEnumStrings gets the string values that are valid for an enum
func GetFloatMax ¶
GetFloatMax gets the maximum of a floating point value
func GetFloatMin ¶
GetFloatMin gets the minimum of a floating point value
func GetString ¶
GetString returns the string value of a feature we deviate from SDK3 API by using GetStringMaxLength internally and avoid users having to deal with allocating C.wchar_t buffers
func GetStringMaxLength ¶
GetStringMaxLength returns the length of a string, use this to determine how big of a cgo.widechar string to allocate
func InitializeLibrary ¶
func InitializeLibrary() error
InitializeLibrary calls the function of the same name in the Andor SDK
func IssueCommand ¶
IssueCommand sends a command to the SDK
func SetEnumIndex ¶
SetEnumIndex sets the value of a feature to an index in the backing enum
func SetEnumString ¶
SetEnumString sets the value of a feature to a string that is a valid member of the backing enum
func SoftwareVersion ¶
SoftwareVersion returns the software (SDK) version InitializeLibrary must be called first
func UnpadBuffer ¶
UnpadBuffer strips padding bytes from a buffer
Types ¶
type Camera ¶
type Camera struct { sync.Mutex // Handle holds the int that points to a specific camera Handle int // UseSpinner indicates whether to run a spinner in the command line when // taking video UseSpinner bool // contains filtered or unexported fields }
Camera represents a camera from SDK3
func Open ¶
Open opens a connection to the camera. Typically, a real camera is index 0, and there are two simulator cameras at indices 1 and 2
func (*Camera) Allocate ¶
Allocate creates the buffer that will be populated by the SDK it should be called at init, and whenever the AOI or encoding changes AT_Flush is called to ensure stale buffers are not held by the SDK
func (*Camera) Buffer ¶
Buffer the current buffer at this moment in time. This is technically a copy but go slices are allocated on the heap, so it only copies the header with minimal performance impact.
may have undefined behavior if camera is writing while you read
func (*Camera) Burst ¶
Burst performs a burst by taking N images at M fps. The images are streamed to ch, and are image.Gray16. the channel is always closed after
func (*Camera) CollectHeaderMetadata ¶
CollectHeaderMetadata satisfies generichttp/camera and makes a stack of FITS cards
func (*Camera) Configure ¶
Configure takes a map of interfaces and calls Set_xxx for each, where xxx is Bool, Int, etc.
func (*Camera) Features ¶
Features returns a map of feature names to their types, as strings the types map as:
int => int float => float64 string => string bool => bool enum => string
Caller editing of the map is considered a usage error and results in undefined behavior
the error is always nil
func (*Camera) GetAOIHeight ¶
GetAOIHeight is the height of one column in the image buffer in pixels. This function allows us to cache the value without going to the SDK for it. Use GetInt directly if you want to guarantee there are no desync bugs.
func (*Camera) GetAOILeft ¶
GetAOILeft gets the left pixel of the AOI. Starts at 1.
func (*Camera) GetAOIStride ¶
GetAOIStride is the stride of one row in the image buffer in bytes. This function allows us to cache the value without going to the SDK for it. Use GetInt directly if you want to guarantee there are no desync bugs.
func (*Camera) GetAOIWidth ¶
GetAOIWidth is the width of one row in the image buffer in pixels. This function allows us to cache the value without going to the SDK for it. Use GetInt directly if you want to guarantee there are no desync bugs.
func (*Camera) GetBinning ¶
GetBinning gets the binning
func (*Camera) GetCooling ¶
GetCooling gets if temperature control is currently active or not
func (*Camera) GetDriverVersion ¶
GetDriverVersion gets the software version of the SDK
func (*Camera) GetExposureTime ¶
GetExposureTime gets the current exposure time as a duration
func (*Camera) GetFeature ¶
GetFeature implements generichttp/camera.FeatureManipulator the return value's type is known through the camera.Features() function the types map as:
int => int float => float64 string => string bool => bool enum => string (current value)
func (*Camera) GetFeatureInfo ¶
GetFeatureInfo retrieves information about a feature which varies based on its type
func (*Camera) GetFirmwareVersion ¶
GetFirmwareVersion gets the firmware version of the camera
func (*Camera) GetFrame ¶
GetFrame triggers an exposure and returns the frame as an image.Gray16 masquerading as an image.Image
func (*Camera) GetFrameSize ¶
GetFrameSize returns the AOI W, H
func (*Camera) GetSDKVersion ¶
GetSDKVersion gets the software version of the SDK
func (*Camera) GetSensorHeight ¶
GetSensorHeight gets the height of the sensor in pixels
func (*Camera) GetSensorWidth ¶
GetSensorWidth gets the width of the sensor in pixels
func (*Camera) GetSerialNumber ¶
GetSerialNumber return the serial number
func (*Camera) GetTemperature ¶
GetTemperature gets the current temperature of the sensor in Celsius
func (*Camera) GetTemperatureSetpoint ¶
GetTemperatureSetpoint gets the temp control setpoint as a string
func (*Camera) GetTemperatureSetpoints ¶
GetTemperatureSetpoints gets a list of strings representing the temperatures the detector can currently be cooled to
func (*Camera) GetTemperatureStatus ¶
GetTemperatureStatus gets the current status of sensor cooling. One of: - Cooler Off - Stabilised - Cooling - Drift - Not Stabilised - Fault
func (*Camera) ImageSizeBytes ¶
ImageSizeBytes is the size of the image buffer in bytes. This function allows us to cache the value without going to the SDK for it. Use GetInt directly if you want to guarantee there are no desync bugs.
func (*Camera) QueueBuffer ¶
QueueBuffer puts the Camera's internal buffer into the write queue for the SDK only one buffer is supported in this wrapper, though the SDK supports multiple buffers
func (*Camera) SetAOI ¶
SetAOI updates the AOI and re-allocates the buffer. Width and height are calculated from the difference of the sensor dimensions and top-left if they are zero
func (*Camera) SetBinning ¶
SetBinning sets the AOIBinning feature
func (*Camera) SetCooling ¶
SetCooling sets if temperature control is currently active or not
func (*Camera) SetExposureTime ¶
SetExposureTime sets the exposure time as a duration
func (*Camera) SetFeature ¶
SetFeature implements generichttp/camera.FeatureManipulator the feature's type is known through the camera.Features() function the types map as:
int => int float => float64 string => string bool => bool enum => string
This function will return an error if the feature is not known or the type is mismatched, with the exception of integral float64s for integer features or integers for float64s
func (*Camera) SetTemperatureSetpoint ¶
SetTemperatureSetpoint sets the temp control point to a value that is returned by GetTemperatureSetpoints
type DRVError ¶
type DRVError struct {
// contains filtered or unexported fields
}
DRVError represents a driver error
type ErrFeatureNotFound ¶
type ErrFeatureNotFound struct { // Feature is the specific feature not found Feature string }
ErrFeatureNotFound is generated when a feature is looked up in the Features map but does not exist there
func (ErrFeatureNotFound) Error ¶
func (e ErrFeatureNotFound) Error() string
Error satisfies the error interface