forked from federicoscarpioni/pyeclab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtech_objects.py
53 lines (45 loc) · 2.04 KB
/
tech_objects.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'''
This module contains dataclasses to define user parameter for each technique
as object to be passed to the instrument for loading the technique. The dataclass
stores:
- The user paramters as attributees of the dataclass (they are not used by the
instrument)
- The ecc_file path of the technique (use from the device to define the technique
in the hardware)
- The params tuple of the technique parameters (used to send the correct format
to the hardware and override default technique paramters with users one)
Having one dataclass per technique allows to concatante techniques into a sequence
passed as a list to the load_sequence() method of the BiologiDevice class.
'''
import tech_names as tn
from api.kbio_tech import make_ecc_parm, make_ecc_parms
import tech_names as tnames
from dataclasses import dataclass
@ dataclass
class OCV:
duration : float
record_dt : float
record_dE : float
E_range : int
bandwidth : int
def __postinit__(self):
self.param_names = tn.OCV_parm_names
def choose_ecc_file(self, device):
# .ecc file names
ocv3_tech_file = "ocv.ecc"
ocv4_tech_file = "ocv4.ecc"
# pick the correct ecc file based on the instrument family
self.ecc_file = ocv3_tech_file if device.is_VMP3 else ocv4_tech_file
def make_ecc_params(self, device):
p_duration = make_ecc_parm(device, tnames.OCV_parm_names['duration'], self.duration)
p_record = make_ecc_parm(device, tnames.OCV_parm_names['record_dt'], self.record_dt)
p_erange = make_ecc_parm(device, tnames.OCV_parm_names['E_range'], self.e_range)
p_band = make_ecc_parm(device, tnames.OCV_parm_names['bandwidth'], self.bandwidth)
self.ecc_parms_OCV = make_ecc_parms(device,
p_duration,
p_record,
p_erange,
p_band)
def make_tech(self, device):
self.choose_ecc_file(device)
self.make_ecc_params(device)