Skip to content
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

Add Keithley2281S #1054

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

Conversation

PfannenHans
Copy link

Add support for Keithley2281S-20-6 battery simulator and analyzer.

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.

Thank you for your contribution, it is always great to see new contributors.

A few quick comments to the code and some general comments:

pymeasure/instruments/keithley/keithley2281S.py Outdated Show resolved Hide resolved
@PfannenHans PfannenHans force-pushed the keithley2281s branch 2 times, most recently from a975c96 to 868dc34 Compare May 7, 2024 08:45
Copy link

codecov bot commented May 7, 2024

Codecov Report

Attention: Patch coverage is 78.00000% with 33 lines in your changes are missing coverage. Please review.

Project coverage is 58.33%. Comparing base (5e1a514) to head (374b8ab).
Report is 6 commits behind head on master.

❗ Current head 374b8ab differs from pull request most recent head 0d39ae2. Consider uploading reports for the commit 0d39ae2 to get more accurate results

Files Patch % Lines
pymeasure/instruments/keithley/keithley2281S.py 77.70% 33 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1054      +/-   ##
==========================================
+ Coverage   58.16%   58.33%   +0.16%     
==========================================
  Files         259      260       +1     
  Lines       17934    18083     +149     
==========================================
+ Hits        10432    10548     +116     
- Misses       7502     7535      +33     
Flag Coverage Δ
unittests 58.33% <78.00%> (+0.16%) ⬆️

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.

@PfannenHans PfannenHans marked this pull request as ready for review May 7, 2024 13:19
@PfannenHans
Copy link
Author

Unfortunately I could not find a solution for the warnings ins the Documentation generation step.

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.

Thanks for your contribution. I added a few comments.

docs/api/instruments/keithley/keithley2281S.rst Outdated Show resolved Hide resolved
tests/instruments/keithley/test_keithley2281S.py Outdated Show resolved Hide resolved
pymeasure/instruments/keithley/keithley2281S.py Outdated Show resolved Hide resolved
pymeasure/instruments/keithley/keithley2281S.py Outdated Show resolved Hide resolved
pymeasure/instruments/keithley/keithley2281S.py Outdated Show resolved Hide resolved
pymeasure/instruments/keithley/keithley2281S.py Outdated Show resolved Hide resolved
pymeasure/instruments/keithley/keithley2281S.py Outdated Show resolved Hide resolved
elif function_mode == "SIMULATOR":
return self.bs_buffer_data

# Common commands (cm_*), these can be used in any function mode
Copy link
Member

Choose a reason for hiding this comment

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

Did you consider using channels for the power supply, battery testing, and battery simulation modes?

That would make it easier to understand, I think, as you could drop all the prefixes.

Copy link
Author

Choose a reason for hiding this comment

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

Good idea, i will look into channels. They must be mutually exclusive thou.

Copy link
Member

Choose a reason for hiding this comment

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

You could add/remove the channels dynamically.
However, I think it is best to keep them active, as the driver never know, which mode the device is in.
Right now, you do not disable these "forbidden" methods either.

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: I thought about three different channels: One simulation, one measurement and one power supply.

@BenediktBurger
Copy link
Member

Unfortunately I could not find a solution for the warnings ins the Documentation generation step.

I do not understand them either.
As both enums are broken, you could try a few things: Maybe the comments are the problem or the underscores. Another idea is to check their docstrings.

Finally, if you make the enum values descriptive, you do not have to add them to the .rst file, which will make the error disappear (I guess).

@mcdo0486
Copy link
Contributor

mcdo0486 commented May 7, 2024

Unfortunately I could not find a solution for the warnings ins the Documentation generation step.

This is caused by generating documentation for inherited methods for the enum.IntFlag classes (Keithley2281SOperationEventRegister & Keithley2281SMeasurementEventRegister) in docs/api/instruments/keithley/keithley2281S.rst

I made a small PR for your branch if you'd like to merge it, which removes the inheritance.

The inherited docstrings in int do not follow some linting rules. In fact, I think you can just remove the Keithley2281SOperationEventRegister & Keithley2281SMeasurementEventRegister classes from generated documentation, as the user wouldn't be using those classes directly.

@BenediktBurger
Copy link
Member

Ah, that makes sense. Thanks @mcdo0486 .

Do not document inheritance from enum.IntFlag classes
@BenediktBurger
Copy link
Member

Your changes till now look good, only the question of channels remains open.

Please refrain from force-pushing commits as that prevents github from showing previous comments on the right spot (as the respective commit is not present anymore).

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.

None yet

3 participants