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

Implement dictionaries for power and temperature sweep data #58

Open
crmcrae opened this issue Feb 8, 2020 · 10 comments
Open

Implement dictionaries for power and temperature sweep data #58

crmcrae opened this issue Feb 8, 2020 · 10 comments

Comments

@crmcrae
Copy link
Contributor

crmcrae commented Feb 8, 2020

I propose we use Python dictionaries to organize sets of data for various powers and temperatures, which our TLS fitting and power/temp sweep plotting tools would then read in. What do you think @mullinska ?

@mullinska
Copy link
Contributor

I'm not really sure what you mean by using python dictionaries to organize sets of data. Are you saying dynamically during fitting it will keep each data set in a dictionary? If so I don't believe that's necessary because all we really need are the Qi and Qc values from each iteration.

@joshmutus
Copy link
Collaborator

@crmcrae I'm a big fan of using data structures like this when we can. It will simplify the code and make it more readable. To add to that, there's a special thing called a dataclass that is like a dictionary but even more useable that we can use here.

For example we can create a DataSet class like:

@dataclass
class DataSet:
  freqs: Array
  amplitudes: Array
  phases: Array

then when we want to put the information in the dataset we do

new_data = DataSet(freqs = [....], ampliudes = [....], phases = [....])

and we can now access all the attributes really simply, for example when we plot amplitude vs frequency we can write:

plt.plot(new_data.freqs, new_data.amplitudes)

@FaustinCarter
Copy link

FaustinCarter commented Mar 11, 2020 via email

@crmcrae
Copy link
Contributor Author

crmcrae commented Mar 17, 2020

That sounds great, thanks Faustin! @mullinska do you have a preference between pandas and xarray?

@mullinska
Copy link
Contributor

I have used pandas before, but I'm sure that xarray isn't that hard to figure out so I really don't have a strong preference either way. As it stands right now the data is just being stored in numpy arrays inside of a data keeping class.

@FaustinCarter
Copy link

FaustinCarter commented Mar 18, 2020 via email

@joshmutus
Copy link
Collaborator

Hi @FaustinCarter xarray looks like a really interesting option.

@joshmutus
Copy link
Collaborator

@FaustinCarter would you be interested in porting over your data structure into this repo? It might be a nice contained project.

@FaustinCarter
Copy link

Hey @joshmutus, I'm ok with this idea, but it's not clear to me exactly how you want it implemented. Is the idea that this would replace the Resonator class currently located here by using the guts of scraps (xarray based storage with propery-based methods) and adding in the necessary hooks for cryores to use it:

https://github.com/Boulder-Cryogenic-Quantum-Testbed/measurement/blob/ddf922d6717e46c6fcb72454cc597149dfcb29a2/resfit/fit_resonator/resonator.py#L9-L20

Or did you want it implemented in some other way? Another option is that I would be willing to put some work into refactoring and extending the scraps code so that you could just import the scraps class directly (i.e. making scraps a dependency). This might make future updating easier as there would then be a single source for the code. Let me know what you think and I can try and figure out how to go about it.

It might take a bit of time since I'd mostly have to work on it in my spare time.

@mullinska
Copy link
Contributor

Hi @FaustinCarter I saw this post so I thought I would clear up that in the last major push that @joshmutus made, the data is no longer stored in the Resonator class. The current place the data is being stored is:

https://github.com/Boulder-Cryogenic-Quantum-Testbed/measurement/blob/ddf922d6717e46c6fcb72454cc597149dfcb29a2/resfit/fit_resonator/fit_S_data.py#L783-L808

Where there is an option to read in the data from a .csv file or to feed the data directly into the function. The old place the data was being stored (the Resonator class) isn't really being used for anything at the moment, so if the data struct were to be implemented it would need to take over this function.

@scottito scottito added this to the Reorganize code milestone Jul 6, 2023
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

5 participants