Winspec Instrument

Aron Opheij, TU Delft 2019

IMPORTANT REMARK: In the current implementation it is not possible to use this instrument in threads.

Tips for finding new functionality:

Once you have an WinspecInstr object named ws, try the following things: This will list all keywords: [key for key in ws.controller.params] There are shorter lists with only experiment (EXP) and spectrograph (SPT) commands: [key for key in ws.controller.params_exp] # note that prefix EXP_ is removed [key for key in ws.controller.params_spt] # note that prefix SPT_ is removed To filter in those you could try: [key for key in ws.controller.params_exp if ‘EXPOSURE’ in key] [key for key in ws.controller.params_spt if ‘GROOVES’ in key]

To request the value for a keyword try: ws.controller.exp_get(‘EXPOSURETIME’) ws.controller.exp_get(‘GRAT_GROOVES’)

See also

<no title>

class hyperion.instrument.spectrum.winspec_instr.WinspecInstr(settings)

Winspec Instrument

Parameters:settings (dict) – this includes all the settings needed to connect to the device in question.

Information for settings dict: To overwrite certain possible values add a key conaining a list of possible values to the settings dict: For example, if your WinSpec does not have ‘Normal’ mod in shutter_controls, add this key: shutter_controls: - Closed - Opened

accumulations

attribute: Number of Accumulations.

Getter:Returns the Number of Accumulations set in Winspec
Setter:Attempts to updates the Number of Accumulations in Winspec if required. Gives warning if failed.
Type:int
ascii_output

attribute: Also save as ASCII file (next to SPE)

Getter:Returns if ASCII save is enabled.
Setter:Sets saving as ASCII file.
Type:bool
autosave

attribute: Auto-save and prompts: default possible values: ‘Ask’, ‘Auto’, ‘No’

Type:str
avalanche_gain

Get the avalanche gain (only available with EM CCD camera)

Getter:Returns avalanche gain in Winspec
Setter:Tries to change avalanche gain in Winspec if required.
Type:int
bg_file

attribute: Full path to Background File Note: it does not check if the file exists or is it is a valid file.

Type:string
bg_subtract

attribute: Background Subtraction

Getter:Returns if Background Subtraction is enabled.
Setter:Sets Background Subtraction.
Type:bool
ccd

attribute: CCD Readout mode. default possible values: ‘Full’ ‘ROI’

Type:str
central_nm

attribute: Central position of grating in nm

Getter:Returns current central position of grating
Setter:Rotates grating to new nm position. Waits for it to complete.
Type:float
collect_spectrum(wait=True, sleeptime=True)
Retrieves the last acquired spectrum from Winspec.
There are a few possibilities:
- you are not using the autosave of winspec: there will be no sleeps
- you are using the autosave of winspec, but not saving the ascii: there will be no sleeps
- you are using the autosave of winspec, and saving ascii: you need some sleeptime, otherwise things break
- in case of acquiring a spectrum, 0.1s is enough for sleeping
- in case of acquiring an image, you need 1s in between and 2s afterwards
Winspec does wait while acquiring data, but does not send a wait command when it is autosaving.
So the combination of autosaving big ascii data in a scan would cause problems without the sleep.
Pay attention: if you do get the sleeps unwanted, check whether you are sending the correct config yml file!
Parameters:
  • wait (bool) – If wait is True (DEFAULT) it will wait for WinSpec to finish collecting data.
  • sleeptime (bool) – Sleeptime adds some sleeps to make sure Winspec has enough time to Autosave ascii images
Returns:

list or nested list

confirm_overwrite

attribute: Confirm Overwrite File

Type:bool
current_temp

read-only attribute: Temperature measured by Winspec in degrees Celcius.

Getter:Returns the Temperature measured by Winspec.
Type:float
delay_time_s

attribute: The delay time under Experiment/Timing in seconds

Type:float
display_flip

attribute: Display Flip (up-down).

Getter:Returns if Display Flip is set in Winspec.
Setter:Sets Display Flip in Winspec.
Type:bool
display_reverse

attribute: Display Reverse (left-right)

Getter:Returns if Display Reverse is set in Winspec.
Setter:Sets Display Reverse in Winspec.
Type:bool
display_rotate

attribute: Display Rotate.

Getter:Returns if Display Rotation is set in Winspec.
Setter:Sets Display Rotation in Winspec.
Type:bool
exposure_time

attribute: Exposure Time.

Getter:Returns the Exposure Time set in Winspec
Setter:Attempts to updates the Exposure Time in Winspec if required. Gives warning if failed.
Type:Pint Quantity of unit time
fast_safe

attribute: Fast or Safe mode in Experiment/Timing default possible values: ‘Fast’, ‘Safe’

Type:str
file_increment

auto increments file or not

Type:bool
filename

Note that this needs to be set before acquiring a spectrum. If you want to store the SPE files as well, the best approach is to make sure self.autosave = ‘Auto’

use take_spectrum(‘new_name.SPE’) :return:

finalize()

Mandatory function. Get’s called when exiting a ‘with’ statement.

gain

attribute: ADC Gain value.

Getter:Returns Gain set in Winspec
Setter:Attempts to updates Gain setting in Winspec if required. Gives warning if failed.
Type:int
getROI()

Retrieve current Region Of Interest. :return: list containing [top, bottom, v_binsize, left, right, h_binsize]

grating

attribute: Grating number (starts at 1)

Getter:Returns current grating number
Setter:Switched to new grating. Waits for it to complete.
Type:int
idn()

Identify command

Returns:Identification string of the device.
Return type:string
initialize()

Starts the connection to the Winspec softare and retrieves parameters.

is_acquiring

Read only property that indicates if WinSpec is still busy acquiring. Returns True or False.

nm_axis()

Returns list with nm axis values of last collected spectrum.

saveas(filename)

Make WinSpec save current spectrum to disk (in format specified in WinSpec). Note: I’s also possible to use autosave function of WinSpec: self.autosave = ‘Auto’

Parameters:filename (string) – The full path to save the file. If None specified it used default name.
Returns:
setROI(top='full_im', bottom=None, v_binsize=None, left=1, right=None, h_binsize=1)

Note for the new camera (the 1024x1024 one) the horizontal range needs to be a multiple of 4 pixels. If the users input fails this criterium, this method will expand the range. Also the v_group and h_group, need to fit in the specified range. If the input fails, a suitable value will be used. And the user will be warned.

Parameters:
  • top – Top-pixel number (inclusive) (integer starting at 1). Alternatively ‘full_im’ (=DEFAULT) of ‘full_spec’ can be use.
  • bottom – Bottom-pixel number (integer). DEFAULT value is bottom of chip
  • v_binsize – Vertical bin-size in number of pixels (integer). None sums from ‘top’ to ‘bottom’. DEFAULT: None
  • left – Left-pixel number (inclusive) (integer starting from 1). DEFAULT is 1
  • right – Right-pixel number (integer). DEFAULT is rightmost pixel
  • h_binsize – Horizontal binning (integer), DEFAULT is 1
Returns:

Examples:
>>>
setROI('full_im')     returns the full CCD
setROI('full_spec')   returns the full CCD, summed vertically to result in 1D array
setROI(51)            sums from pixel 51 to the bottom
setROI(51, 70)        sums vertically from pixel 51 to 70
setROI(51, 70, 20)    sums vertically from pixel 51 to 70
setROI(41, 60, 5)     result in 4 bins of 5 pixles
setROI(41, 60, 1)     no binning, result will be 20 pixels high
setROI(41, 60, None, 101, 601)      modify horizontal range
setROI(41, 60, None, 101, 601, 10)  apply horizontal binning of 10 pixels (result will be 50 datapoints wide)
shutter_control

attribute: Shutter Control default possible values: ? , ‘Free Run’, ? , ‘External Sync’

Type:str
spec_mode

attribute: True for Spectroscopy Mode, False for Imaging Mode

Type:bool
start_acquiring(name=None)

Starts acquisition of spectrum. Does not wait for it to finish. If name is specified. The last spectrum in WinSpec is closed and a new spectrum with the specified name is created. If name is None (DEFAULT) the current spectrum will be overwritten.

Parameters:name (string) – Full path to file to store. Or None, for using default.
take_spectrum(name=None, sleeptime=True)

Acquire spectrum, wait for data and collect it. Performs start_acquiring(name), followed by collect_spectrum(True). See those methods for more details.

take_spectrum_alt(name=None, sleeptime=True)

Acquire spectrum, wait for data and collect it. Performs start_acquiring(name), followed by collect_spectrum(True). See those methods for more details.

target_temp

attribute: Detector target temperature in degrees Celcius.

Getter:Returns Target Temperature set in Winspec
Setter:Attempts to updates Target Temperature in Winspec if required. Gives warning if failed.
Type:float
temp_locked

read-only attribute: Temperature locked state measured by Winspec in degrees Celcius.

Getter:Returns True is the Temperature is “locked”
Type:bool
timing_mode

attribute: Timing Mode default possible values: ‘Normal’, ‘Closed’, ‘Opened’

Type:str