-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add support for DAC build 8 timing data readback #299
base: master
Are you sure you want to change the base?
Conversation
To potential reviewers: It appears not that much of the original code that is needed to read the timing data from DAC build 8 has been removed. This enhancement fix should be backward compatible since the added code is logically protected by The only nontrivial change, is the following two lines: if isinstance(runner, dac.DacRunner_Build8):
extracted = (extracted,) Without this a few errors are thrown from the pylabrad package modules without any explicit links to the server methods that caused them (one of these cases, when the error traceback is pretty confusing). I guess that the original error is raised due to the improper usage of LabRAD types or something like that but I am not aware of anything that fits better than The disadvantages of the current implementation is an added extremely small computational overhead and somewhat loosen type casting requirements for the The server has been tested in an actual setup configuration that includes DACs build 8 and ADC build 7. Finally, I haven't touched the server version number but the change probably justifies bumping the last digit. Hope this helps. |
@patzinak, thanks for this change. I'm looking at the code in more detail, but have two concerns right off the bat. First, I think we should enforce that the boards from which data is being read back are either all DACs or all ADCs. Returning data as a single rectangular array of ints doesn't make sense in the mixed case (at best, we'd have to do something like return a cluster of ADC data and DAC data because the shapes wouldn't match), but in any case I don't see anyone wanting to use the boards in a configuration where they're getting both ADC demod data and DAC timing data back at the same time. Second, even in the DAC timing data case it's possible to run multiple boards at once, so I think the data format returned by Edit: I think I misunderstood the point of |
I worked on this a bit and came up with the following, which includes validating the timing order up front to ensure we don't try to mix DACs and ADCs or demod and average mode: 634f498 |
@maffoo, first of all, thank you for putting your time in this particular issue. We as a research group, certainly appreciate any efforts on your side that will allow us to seamlessly benefit from any future updates in this repo. Also, though this is not specifically related to the issue, we are currently in a serious process of improving the reliability and measurement efficiency of our setups. I'm going to open a few new issues here. Some questions may sound naive but we try to do our homework: at first we try to find out whether a problem has been already addressed somewhere, if not, one or two of us try to find a solution, and when we have a some sort of consensus in the group on the nature of the problem, we post an issue here. Specifically to this issue, your first concern is something that I have actually thought about and we did in fact at some point had a chip that we intended to characterize running Preamp/DAC and ADC boards simultaneously. The chip turned out to have some fabricational issues but the idea of a mixed experiment (Preamp/DAC readout and ADC demodulation) does not sound crazy for us (think of a qubit coupled to two resonators). Having said this, I am not familiar with the hardware/Ethernet technical details to judge whether this is simply not an intended usage scenario or this is just something that nobody yet wanted to do. My short answer is that we would like to see the more general case implemented but this is not of the highest priority at the moment. As for the second concern, I was a bit confused about the overall vision for the way of returning structurally different data sets. The things makes more sense to me now. Your are right, I intended to do I've looked through your modified code. It looks good to me. If I have a chance I'll test it next week and let you know how well it works for us. Thanks again! Addition: What is the problem with returning always |
@patzinak, I think if we want to support the mixed case of returning both DAC timing data and ADC demod data in one experiment, it would be better to return a cluster like Supporting the mixed case like this would be fairly easy, but I think given that the ADC and DAC data are in two lists we'd probably want to have the user specify to separate "timing order" lists corresponding to these two entries. Again, not too hard, but would probably want to create new settings for this rather than further complicating the existing settings. |
Sorry to jump in late here, but I seem to remember spending a lot of time getting the qubit sequencer to support simultaneous DAC and ADC readback (this was back when we were first developing resonator readout). So I'm guessing that the FPGA server must have supported it, too. Was it removed at some point? |
If it ever worked in the qubit sequencer of fpga server, it must have been removed from both. The problem in both places is the same, namely that the "shape" of data returned by DACs and ADCs is not the same, so they can't really be combined into one rectangular array, which is what we currently return. |
Yes, I see now and agree that padding is not a great option. I also don't really have a strong opinion on this issue as long as the interface is easily comprehensible. Ideally, however, it would be great if:
p.run(reps=1020)
p.data('Board Group 1 DAC 3', key='dac3')
p.data('Board Group 1 ADC 7', key='adc7')
p.data('Board Group 1 ADC 8', key='adc8') Not sure weather relying on contexts here is a good idea from the performance standpoint. Yet, if the performance is an issue than Python is not the best option... On the other hand, our group experience with the GHz FPGA boards is definitely not hassle-free — for us reliability and transparency would be of a higher priority. For now, however, we would be more than happy just to see the critical gaps eliminated between our code repositories. |
Agreed.
I think the proper place for that information is in the code. Trying to sync wiki articles or other external media with the code adds unnecessary complexity.
Shouldn't the doc string for run_sequence be the one-stop-shop for understanding the data returned by
The obvious formatting issues aside, if you could suggest an improvement I am happy to put it in.
How about timing_order = ['DAC 1', DAC 2']
fpga.timing_order(timing_order)
result = fpga.run_sequence(whatever)
result_by_board_name = dict((board_name, data)
for (board_name, data) in zip(timing_order, result)) |
I totally agree — I'd personally love to see everything in the doc strings and in the head comments. Wikis should be reserved for the higher level examples: i.e. tutorials on integrating multiple modules, code structure, vision and so on. However, some people may object having examples that are related to the previous versions when the backward compatibility is broken. In such cases, designated wiki pages could be actually helpful: they should refer to specific code version transitions and must not be updated later (apart from error/typo elimination) because both, the old and new versions, are a part of the history once the transition is implemented. Because of this the information is never outdated: as the time goes it becomes just less useful but is still correct.
It could be, I don't have a strong opinion here. The problem is how to return the heterogeneous data from a single setting. Seems like two ADC modes and DAC timing data create some mess, otherwise we wouldn't have this discussion. But honestly, I'm okay with this mess. I would however argue that doc string is not perfect.
Looks great to me!
What is
This was not previously the case. What was the reason to remove the DAC support? What should I do if I need to collect data from DACs? In an ideal world, I'd expect to see "If you need to acquire the DAC data use version x.y.z of this server." or "The DACs support was removed starting from version x.y.z because the DAC builds that return timing data do not support XYZ protocol.'
"because XYZ communication protocol does not allow this..." or "The mixed mode case is not implemented due to the absence of any real need." If the example from the previous comment works with timing_order = ['DAC 1', 'ADC 2']
... it will be really-really great. |
If we make a breaking change I see no problem to note that in the doc string, at least for a while. When it gets to the point that the change is far enough in the past then it's easy enough to remove a section of documentation.
I think a note in the documentation of the relevant code would be considerably more direct and a lot easier to maintain.
I'm trying to respond to one thing at a time. You said that clustering data is confusing because it assumes that the use code somehow keeps track of the board orders. I pointed out the doc string of
I was not trying to suggest that this actually works in the current version of the code. I was responding to your suggested code wherein each board's data is "fetched" via an independent call to the fpga server. In other words, in pursuing support for the data type you guys want, I think we should aim for an interface that looks like the example I posted, rather than one which involves a separate call to get each board's data. |
I should have made my point clearer and should have specified in the comment that starts with
that the comment mostly refers to:
In fact in one of the earlier comments I said:
implying that keeping track of the board orders is not that hard and could be still assumed in some of the proposed implementations. You can say that I'm contradicting to myself while I consider this to be a discussion of different possibilities. The main point was the following: if some settings are going to be introduced in order to simplify the inhomogeneous data transfer why not to simply the interface? Note, all this could be done by keeping as it is (or improving) the current Again, this is just an idea. You guys are in a better position to make any decision. As for doc strings, as I said I'm in strong favor to keep everything close to the code, i.e. in the doc-strings. I think we are totally on the same page here. |
Btw, totally unrelated, result_by_board_name = dict((board_name, data)
for (board_name, data) in zip(timing_order, result)) is arguably less readable than result_by_board_name = {board: result[k] for k, board in enumerate(timing_order)} |
Yes it is more readable. Please make a PR. I probably didn't know about dict comprehensions when that code was written. Heck, they may not have been in the language at that time. |
This is to address Reading timing information from the preamp cards with GHz DACs #289 issue.