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

Modify femto_ferb _check_visa_support method #139

Open
NitramC opened this issue Apr 25, 2021 · 3 comments
Open

Modify femto_ferb _check_visa_support method #139

NitramC opened this issue Apr 25, 2021 · 3 comments

Comments

@NitramC
Copy link

NitramC commented Apr 25, 2021

Currently the femto_ferb driver will assign the FemtoFiber class to any instrument that responds to the query '(param-ref system-type)', whether or not that respose is valid. It would be good to modify the _check_visa_support method such that is parses the respose and looks for certain keywords. Unfortunately, the documentation does not provide an example response, so someone who has the insturment would need to make the changes, or one would have to contact Toptica to ask.

Something like this would probably work if we know what the search pattern ???? should be:

_SUBCLASS_IDN_SRCPATTERN = {
    # 'subclass': 're.search_pattern'
    'FemtoFiber': '????'
}

def _check_visa_support(visa_rsrc):
    with visa_timeout_context(visa_rsrc, 50):
        try:
            resp = visa_rsrc.query(':version')
            for subclass in _SUBCLASS_IDN_SRCPATTERN.keys():
                if re.search(_SUBCLASS_IDN_SRCPATTERN[subclass], resp) is not None:
                    return subclass
        except:
            pass
    return None
@natezb
Copy link
Contributor

natezb commented Apr 25, 2021

What is the problem you're trying to solve? Do you have some other instrument that's accidentally being recognized as a FemtoFiber?

@NitramC
Copy link
Author

NitramC commented Apr 25, 2021

Yes, exactly; when running list_instruments it occured once.

I am working with another serial instrumemt that does not recognize *IDN?. It also will reply to any unrecognized command with somthing like "unknown command xxxx".

@natezb
Copy link
Contributor

natezb commented Apr 30, 2021

I agree that a change like the one you suggest would be a good one, we just need to find what the string(s) should be.

In the meantime, if you've written a driver for the conflicting instrument, you could give it an earlier _INST_PRIORITY_ so it is tried before the femto ferb driver.

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

No branches or pull requests

2 participants