8000 Siglent by NIK7179 · Pull Request #1237 · pymeasure/pymeasure · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Siglent #1237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Siglent #1237

wants to merge 3 commits into from

Conversation

NIK7179
Copy link
@NIK7179 NIK7179 commented Jan 29, 2025

Added Support for siglent sdm3045x

Copy link
codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.15%. Comparing base (c68c746) to head (8905f5a).
Report is 16 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1237      +/-   ##
==========================================
+ Coverage   59.11%   59.15%   +0.04%     
==========================================
  Files         273      274       +1     
  Lines       19001    19020      +19     
==========================================
+ Hits        11233    11252      +19     
  Misses       7768     7768              
Flag Coverage Δ
unittests 59.15% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member
@BenediktBurger BenediktBurger left a comment

Choose a reason for hiding this comment

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

A few more comments.

Thanks for contributing.

@@ -25,3 +25,4 @@
from .siglent_spd1168x import SPD1168X
from .siglent_spd1305x import SPD1305X
from .siglent_sds1072cml import SDS1072CML
from .siglent_sdm3045x import SiglentSDM3045X
Copy link
Member

Choose a reason for hiding this comment

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

The other devices are just called "SDS...", so "SDM3045X" would be more fitting, but for other manufacturers, it's different. So do it as you wish.

Comment on lines +41 to +44
Args:
adapter: VISA Adapter used to communicate with the instrument.
name: Optional name for the instrument (default: "Siglent SDM3045X Multimeter").
"""
Copy link
Member

Choose a reason for hiding this comment

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

We use sphinx for generating documentation, so use:

Suggested change
Args:
adapter: VISA Adapter used to communicate with the instrument.
name: Optional name for the instrument (default: "Siglent SDM3045X Multimeter").
"""
:param adapter: VISA Adapter used to communicate with the instrument.
:param name: Optional name for the instrument (default: "Siglent SDM3045X Multimeter").
"""

Copy link
Member

Choose a reason for hiding this comment

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

By the way, there should be no init docstring. This information should be in the class docstring.

super().__init__(
adapter,
name,
includeSCPI=True,
Copy link
Member

Choose a reason for hiding this comment

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

We use a different technique to add SCPI instruments, now: Please inherit from "Instrument" and from "SCPIMixin".
Then you can remove this line:

measurement_mode = Instrument.control(
"CONFigure?", # Query command to get the current measurement mode
"CONFigure:%s", # Command format to set the measurement mode
"A string property to set the measurement mode. Supported values are "
Copy link
Member

Choose a reason for hiding this comment

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

We changed the way, how to write docstrings:

Suggested change
"A string property to set the measurement mode. Supported values are "
"Control the measurement mode. Supported values are "

See https://pymeasure.readthedocs.io/en/latest/dev/coding_standards.html#docstrings

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for adding tests.

measurement_mode = Instrument.control(
"CONFigure?",
"CONFigure:%s",
"Set the measurement mode "
Copy link
Member

Choose a reason for hiding this comment

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

If it is a control, please use "Control:

Suggested change
"Set the measurement mode "
"Control the measurement mode "

Set is for a setting and Get/Measure for a measurement.

dc_voltage_range = Instrument.control(
"VOLT:RANGe?",
"VOLT:RANGe %g",
"Set the DC voltage range in volts.",
Copy link
Member

Choose a reason for hiding this comment

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

You can specify the limits (and the strictness), here a suggestion:

Suggested change
"Set the DC voltage range in volts.",
"Set the DC voltage range in volts (float strictly between 0.1 and 1000).",

Comment on lines +88 to +103
def reset(self):
"""
Resets the instrument to its default state.
This is equivalent to pressing the reset button on the instrument.
"""
self.write("*RST")

def identify(self):
"""
Queries the device identity.

Returns:
str: The identity string of the instrument, typically including
manufacturer, model, and serial number.
"""
return self.ask("*IDN?")
Copy link
Member

Choose a reason for hiding this comment

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

These commands are already defined in SCPIMixin, so no need to repeat.

Comment on lines +105 to +111
def close(self):
"""
Closes the instrument connection.

Ensures the connection is properly terminated.
"""
self.adapter.connection.close()
Copy link
Member

Choose a reason for hiding this comment

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

That is already in the instrument itself, if I remember correctly.

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
0