SK Polarimeter¶
This class (polarization.py) is the model to connect to the SK Polarization analyzer from SK.
The model is similar to the controller, but it adds specific functionalities such as units with Pint and error descriptions
copyright: | by Hyperion Authors, see AUTHORS for more details. |
---|---|
license: | BSD, see LICENSE for more details. |
-
class
hyperion.instrument.polarization.polarimeter.
Polarimeter
(settings)¶ This class is the model for the SK polarization.
-
change_wavelength
(w)¶ Change the current wavelegnth to w
Parameters: w (pint quantity (distance)) – wavelength Returns: current wavelength Return type: pint quantity (distance)
-
create_header
(errors=False, extra_name=None, extra_unit=None, extra_description=None)¶ creates the header to save the data
Parameters: - extra_name (str) – if a first column has to be added, this is the name
- extra_unit (str) – if a first column has to be added, this is the unit
- extra_description (str) – if a first column has to be added, this is the description
Returns: header with the information of the data saved
Return type: string
-
finalize
()¶ Finishes the connection to the SK polarization
-
get_average_data
(N)¶ Takes N data points and gives back the average and the error (std)
Returns: av, array with dim 13 containing the average of the N measurements for each property in DATA_TYPES, and the std Return type: numpy array Returns: st, array with dim 13 containing the std of the N measurements for each property in DATA_TYPES, and the std Return type: numpy array - Example:
>>> av, st = get_average_data(10) >>> print('Values: {} +/- {}'.format(av, st)) Values
-
get_data
()¶ This methods gets the a single measurement point from the device. It reads all the types of data available, listed in DATA_TYPES.
Returns: a list with the data Return type: list
-
get_information
()¶ gets the information from the device: number of polarizers and id.
-
get_multiple_data
(N)¶ This is to get a stream of data directly from the device.
Parameters: N (int) – number of data points needed Returns: a np array
-
get_wavelength
()¶ asks the device the current wavelength.
Returns: current wavelength Return type: pint quantity
-
initialize
(wavelength=None)¶ This is to initialize the model by calling the initizialize function in the controller. It adds units for the wavelength
Parameters: wavelength (pint quantity) – the working wavelength
-
save_as_netCDF4
(filename, data)¶ Saves the data from the polarimeter measurement into a netCDF4 file.
-
save_data
(data, extra=[None, None, None, None], file_path='polarimeter_test.txt')¶ saves the data. It assumes that the data comes from the SK so it is a matrix of 13 rows and an arbitrary number of columns.
Parameters: - data (numpy array) – array of (N,13)
- extra – list containing the extra vector to save (1xN), the name of the extra data and
the unit. For example: [np.array([1,2,3]),’time’,’second’,’elapsed time’]. :type extra: list
-
start_measurement
()¶ This method starts the measurement for the polarization analyzer.
-
stop_measurement
()¶ This method stops the measurement for the polarization analyzer.
-