IX or BX Olympus microscope body.
| 61 | |
| 62 | |
| 63 | class IXBX(MessageBasedDriver): |
| 64 | """ IX or BX Olympus microscope body. |
| 65 | """ |
| 66 | |
| 67 | DEFAULTS = {'ASRL': {'write_termination': '\r\n', |
| 68 | 'read_termination': '\r\n', |
| 69 | 'baud_rate': 19200, |
| 70 | 'bytesize': 8, |
| 71 | 'parity': constants.Parity.even, |
| 72 | 'stop_bits': constants.StopBits.one, |
| 73 | 'encoding': 'ascii', |
| 74 | }} |
| 75 | |
| 76 | |
| 77 | def initialize(self): |
| 78 | super().initialize() |
| 79 | self.send('1LOG IN\n') |
| 80 | self.send('2LOG IN') |
| 81 | |
| 82 | def query(self, command, *, send_args=(None, None), recv_args=(None, None)): |
| 83 | """Query the instrument and parse the response. |
| 84 | |
| 85 | :raises: InstrumentError |
| 86 | """ |
| 87 | response = super().query(command, send_args=recv_args, recv_args=recv_args) |
| 88 | command = command.strip()[0] |
| 89 | if response in ('1x', '2x'): |
| 90 | raise InstrumentError("Unknown command: '{}'".format(command)) |
| 91 | if not response.startswith(command): |
| 92 | raise InstrumentError("Unknown response: '{}'".format(response)) |
| 93 | if response == 'X' or 'x': |
| 94 | raise InstrumentError('Unable to set') |
| 95 | elif not response == '+': |
| 96 | raise InstrumentError("Unknown response: '{}'".format(response)) |
| 97 | return response |
| 98 | |
| 99 | @Feat(read_once=True) |
| 100 | def idn(self): |
| 101 | """Microscope identification |
| 102 | """ |
| 103 | return self.query('1UNIT?') |
| 104 | |
| 105 | fluo_shutter = ofeat('1LED', |
| 106 | 'External shutter for the fluorescent light source', |
| 107 | values=ONE_ZERO) |
| 108 | |
| 109 | lamp_epi_enabled = ofeat('1LMPSEL', |
| 110 | 'Illumination source lamp.', |
| 111 | values=EPI_DIA) |
| 112 | |
| 113 | lamp_enabled = ofeat('1LMPSW', |
| 114 | 'Turn the currently selected lamp onf and off', |
| 115 | values=ON_OFF) |
| 116 | |
| 117 | lamp_intensity = ofeat('1LMP', |
| 118 | 'Transmitted light intensity', |
| 119 | procs=(INTSTR, )) |
| 120 |