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

Redesign parameter handling #21

Open
nwittler opened this issue Jan 25, 2021 · 0 comments
Open

Redesign parameter handling #21

nwittler opened this issue Jan 25, 2021 · 0 comments
Labels
can-wait Not working, not urgent enhancement New feature or request

Comments

@nwittler
Copy link
Collaborator

nwittler commented Jan 25, 2021

Is your feature request related to a problem? Please describe.

Describe the solution you'd like
Previously parameters of both model and control components were managed in a object.params dictionary. This should be modified so that the property is directly a field of the object. E.g. qubit.params["frequency"] becomes qubit.frequency.
Example:

c3/c3/system/chip.py

Lines 77 to 99 in ef95330

def __init__(
self,
name,
hilbert_dim,
desc=None,
comment=None,
freq=None,
anhar=None,
t1=None,
t2star=None,
temp=None,
params=None,
):
# TODO Cleanup params passing and check for conflicting information
super().__init__(
name=name,
desc=desc,
comment=comment,
hilbert_dim=hilbert_dim,
params=params,
)
if freq:
self.params['freq'] = freq

For this to work each object needs to implement a get_parameters() method that exposes properties to the parametermap to be used instead of comp.params.items() in the following:

c3/c3/parametermap.py

Lines 38 to 45 in ef95330

def __initialize_parameters(self) -> None:
par_lens = {}
pars = {}
for comp in self.__components.values():
for par_name, par_value in comp.params.items():
par_id = "-".join([comp.name, par_name])
par_lens[par_id] = par_value.length
pars[par_id] = par_value

Describe alternatives you've considered

Additional context

@nwittler nwittler added the enhancement New feature or request label Jan 25, 2021
@lazyoracle lazyoracle added the can-wait Not working, not urgent label Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can-wait Not working, not urgent enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants