Conversation
|
Interesting... I like where this is going. There is no such method yet, the only thing we have is blocking the next As to how Then we could move the
|
|
The PR now has a more generic system for adding callbacks. It might not do everything listed above, but the system is simple and works for me. Typical use case: import pyqtgraph
qtapp=pyqtgraph.mkQApp()
qc.DataSet.background_functions['qt'] = qtapp.processEvents()
...
data = qc.Loop(sweepvalues, delay=delay).run(background=True)
# setup plotting window etc.
...
# wait for loop to complete
data.complete() |
qcodes/data/data_set.py
Outdated
| location_provider = TimestampLocation() | ||
|
|
||
| # functions to be called when operating in background mode | ||
| background_functions=dict() |
There was a problem hiding this comment.
@peendebak apologies for letting this get stale...
I like the dict - good call, so the key labels it and helps you remove or update the appropriate one. Any reason not to declare it with {} though?
I guess the reason to make this a class rather than an instance variable is that this callback won't change from run to run? If that works for your use case lets keep this, but we should pay attention to how people use this and figure out if we have reason to add instance callbacks too.
|
Is this summing over I was thinking just counting the passed datapoints would work: import numpy as np
x = np.random.random(10)
y = np.random.random(5)
ntotal = len(x)*len(y)
npassed = 0
for i in x:
for j in y:
npassed += 1
print(npassed/ntotal)But that would break down for |
Good point @MerlinSmiles - Given the current structure of loops (which I don't see changing but you never know...) within a given dimension you always start filling in data from the first point, but you can leave gaps if there is a We first search the first column, and find that the 4th row is the last data point. Then we search the 4th row and find that the 6th column is the last data point, so completion is (3 + 6/10)/7 = 51.4% |
…_complete And document the new stuff in this branch
| if getattr(self, 'synced_index', None) is not None: | ||
| last_index = max(last_index, self.synced_index) | ||
|
|
||
| return (last_index + 1) / self.ndarray.size |
There was a problem hiding this comment.
@peendebak @MerlinSmiles no need to search for the fraction complete, the DataArray already tracks this for sync and save. It's a little annoying to have to look at three different attributes, maybe later we can tighten this up, but I think it's OK for now.
- If you read in a DataSet (ie with load_data) then it is marked as saved up to whatever data you read in. The `Formatter` handles this. - If you create a DataSet with preset data, then it is marked as 100% modified - ie it's entirely data that has not been saved. the DataArray constructor and nest method handle this.
Now it doesn't return anything, and only catches errors from the background_functions, removing functions which fail twice in a row Any other errors (like from sync()) will not be caught so will stop future code from running when it shouldn't
| self.sync_index = i + 1 | ||
| return self.sync_index < self.syncing_array.size | ||
|
|
||
| def failing_func(self): |
|
Issues
======
- Added 1
Complexity increasing per file
==============================
- qcodes/tests/test_data.py 1
- qcodes/data/data_array.py 10
- qcodes/data/gnuplot_format.py 1
Complexity decreasing per file
==============================
+ qcodes/data/data_set.py -2
Clones removed
==============
+ qcodes/tests/test_format.py -7
See the complete overview on Codacy |
|
In order to make I also changed how @peendebak / @eendebakpt I haven't seen you around lately so I'm going to assume you're offline - but I don't expect this is too controversial. We can always adjust it later if you have concerns. (Anyway thanks for making this PR in the first place!) @giulioungaretti any more comments from your human self, as opposed to your bot alter-ego? |
After starting a measurement I would like to make sure the measurement is complete. I start the measurement in the background because I want live plotting to work.
Is there already a method to do this? In this PR I added a method to the
DataSetobject.A typical use case