microsoft / microsoft/Qcodes

keithley 2000 readout error

Open
#961 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
459
Forks
359
Avg merge
3d 6h
Merged PRs (30d)
73

Description

From the code:
```
self.add_parameter('trigger_count',
get_cmd='TRIG:COUN?',
get_parser=int,
set_cmd='TRIG:COUN {}',
vals=MultiType(Ints(min_value=1, max_value=9999),
Enum('inf',
'default',
'minimum',
'maximum')))
```
When doing an `instrument.ask_raw('TRIG:COUN?')` my device returns a string ` '+9.9e37'`. This gives an error since `int('+9.9e37'` results in `ValueError: invalid literal for int() with base 10: '+9.9e37'`.

We might want to change the `get_parser` into `lambda x: int(float(x))`.

Also: since the `get_parser` is `int`, does the `MultiType` validator make sense?

@jenshnielsen @WilliamHPNielsen

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Keithley 2000 driver parameter shown in the issue and reproduce the ask_raw('TRIG:COUN?') response of '+9.9e37'. Check how the get_parser and MultiType validator handle that value, then confirm the expected parsing and validation behavior. Done means the returned device value is handled consistently without breaking valid trigger-count values.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.