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

kwargs break build_fragment #254

Open
hartytp opened this issue Nov 19, 2021 · 4 comments
Open

kwargs break build_fragment #254

hartytp opened this issue Nov 19, 2021 · 4 comments

Comments

@hartytp
Copy link
Contributor

hartytp commented Nov 19, 2021

# TODO: Also handle kwargs, make sure this generates valid identifiers.

@hartytp
Copy link
Contributor Author

hartytp commented Nov 19, 2021

Currently passing a kwarg into build_fragment results in obscure Mismatch in parameter schema warnings...

@dnadlinger
Copy link
Member

The above link doesn't seem to be to a public repo…

@hartytp
Copy link
Contributor Author

hartytp commented Nov 19, 2021

Sorry! updated to point to upstream.

Here is a (pseudocode) test case which should fail at the moment:

import ndscan.experiment as nd

class Foo(nd.Fragment):
    def build_fragment(self, transition):
        self.setattr_param('t_pi',
                           nd.FloatParam,
                           "π pulse duration",
                           f"dataset('{transition}.t_pi', 3*us)",
                           unit="us",
                           min=0.0)

class bar(nd.ExpFragment):
    def build_fragment(self):
        self.setattr_fragment("baz0", Foo, transition='a')
        self.setattr_fragment("baz1", Foo, transition='b')

This check fails https://github.com/OxIonics/ndscan/blob/3fcc4e1077ad9e0f327854c6015279c3300bebcc/ndscan/experiment/fragment.py#L446 because it doesn't like the different default data sets for the two Fragment instantiations.

If we pass these in as positional args (so no transition=) then it works.

@hartytp
Copy link
Contributor Author

hartytp commented Nov 20, 2021

@dnadlinger I haven't got a good mental model of how to think about fqns in ndscan. I roughly get how they are used, but any clarifications would help. Why does the fqn need to include the arguments passed into build_fragment?

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