gdv
New Member
Posts: 2
|
Post by gdv on Mar 11, 2022 10:10:51 GMT -5
Dear all, Hi, I have a problem with controlling the Temperature Controller Model335 through Python scripting. I want to configure the set point temperature of the Model335 using serial connection and Python programming, but when I send a command to the instrument, it says that the class that I imported doesn't have the method that I want to use. That is very strange because if I run the exact code using the Python console a couple of times, it can find the method and doesn't give error. Here I attach the code:
and this is the error:
I am sure that the serial connection is open, and the buffer is flushed, so the communication isn't the issue here. I suspect it is an issue with the initialization of the class Model335(), do you have any idea of what would be the problem? Thanks, Giulio Attachments:
|
|
|
Post by Lake Shore Jeff M on Mar 12, 2022 14:45:50 GMT -5
compatibility with many of our existing instruments has been added to the Lake Shore Python driver. pypi.org/project/lakeshore/ Instruments with a USB or Ethernet port should be supported by this update. Instruments with a DB-9 serial port are not supported by this driver, but could still be manually communicated with as before. Here is an example script using the new driver. It reads temperature from a 240 Series module and sends it to a teslameter to use for temperature compensation. The original code from before the 240 was officially supported was much longer than this. from time import sleep from lakeshore import Teslameter from lakeshore import Model240 STEP = 2 # query interval in seconds CHANNEL = 1 # 240 Channel to use for temperature compensation my_teslameter = Teslameter() my_240 = Model240() try: while(True): temperature = float(my_240.query('CRDG? %i' % CHANNEL)) print('Temperature: %f C ' % temperature, end='') my_teslameter.configure_temperature_compensation(temperature_source='MTEM',manual_temperature=temperature) print('Field: %f T \r' % my_teslameter.get_dc_field(), end='') sleep(STEP) except KeyboardInterrupt: print("\ndone") finally: my_240.disconnect_usb() my_teslameter.disconnect_usb()
|
|
gdv
New Member
Posts: 2
|
Post by gdv on Mar 22, 2022 11:52:13 GMT -5
Dear Jeff,
thanks a lot, the SCPI commands with query() and command() work. The problem is that the method "all_heater_off()" gives the error: AttributeError: 'Model335' object has no attribute 'all_heater_off'
even thou, the query commands are working correctly and I am using the lakeshore package 1.5.3. If I use the console command, that method is recognized and it is working, just in the moment that I use the command in the script then I have the AttributeError.
All the best, Giulio
|
|