Skip to content

Added DMT Current Source Drivers#11

Open
Kaushik3112 wants to merge 2 commits into
toolsforexperiments:mainfrom
Kaushik3112:DMT-Current-Source
Open

Added DMT Current Source Drivers#11
Kaushik3112 wants to merge 2 commits into
toolsforexperiments:mainfrom
Kaushik3112:DMT-Current-Source

Conversation

@Kaushik3112
Copy link
Copy Markdown

I have added the drivers for the new current source.

"""Set current value for the channel"""
curr_range = self.get_range()
temperature = self.root_instrument.get_temp()
# print(self.ask("!help"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented print

check_response = self.ask('!chk;'+self.channel)
params = check_response.strip().split(';')
curr_range = float(params[2].rstrip("mA"))
# curr_value = float(params[3].rstrip("uA"))
Copy link
Copy Markdown
Contributor

@marcosfrenkel marcosfrenkel May 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented code

Suggested change
# curr_value = float(params[3].rstrip("uA"))

"""Check range and current of the channel"""
check_response = self.ask('!chk;'+self.channel)
params = check_response.strip().split(';')
# curr_range = float(params[2].rstrip("mA"))
Copy link
Copy Markdown
Contributor

@marcosfrenkel marcosfrenkel May 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented code

Suggested change
# curr_range = float(params[2].rstrip("mA"))

Comment on lines +52 to +53
"""
"""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""
"""

Comment on lines +17 to +36
"""
Some basic concepts for this current source:

VisaInstrument:
This basic current source has up to 8 channels that are accessible to the user. Most functions will be contained
within the channel function but the temperature of the current source is general and needs to be
checked to ensure that it is not overheating.

Channel:
Each channel only has two basic functions that we can set: the current and the range (range of 4 mA or 40 mA with
resolution of 0.125 uA or 1.25uA)
The only string each channel returns is the following: #chk;channelnumber;range;value
For some weird reason the range is in mA but the current value is in uA.

"""

"""
Helper Functions

"""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep everything in a single docstring

Suggested change
"""
Some basic concepts for this current source:
VisaInstrument:
This basic current source has up to 8 channels that are accessible to the user. Most functions will be contained
within the channel function but the temperature of the current source is general and needs to be
checked to ensure that it is not overheating.
Channel:
Each channel only has two basic functions that we can set: the current and the range (range of 4 mA or 40 mA with
resolution of 0.125 uA or 1.25uA)
The only string each channel returns is the following: #chk;channelnumber;range;value
For some weird reason the range is in mA but the current value is in uA.
"""
"""
Helper Functions
"""

A driver to control the DM Technologies Multichannel current source

@author: Kaushik & Angela Kou

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Some basic concepts for this current source:
VisaInstrument:
This basic current source has up to 8 channels that are accessible to the user. Most functions will be contained
within the channel function but the temperature of the current source is general and needs to be
checked to ensure that it is not overheating.
Channel:
Each channel only has two basic functions that we can set: the current and the range (range of 4 mA or 40 mA with
resolution of 0.125 uA or 1.25uA)
The only string each channel returns is the following: #chk;channelnumber;range;value
For some weird reason the range is in mA but the current value is in uA.

Comment on lines +47 to +49
"""
Drivers
"""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""
Drivers
"""

Comment on lines +172 to +178
def _open_resource( #local visa open resource that sets the baud rate
self, address: str, visalib: str | None
) -> tuple[pyvisa.resources.MessageBasedResource, str, pyvisa.ResourceManager]:

resource, visabackend, resource_manager = super()._open_resource(address, visalib)
resource.baud_rate = 115200
return resource, visabackend, resource_manager
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to open the pyvisa resource ourselves?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is to set the baud_rate as the device only talks to the PC once that is set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants