-
Notifications
You must be signed in to change notification settings - Fork 315
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 debugging and make the final write more robust #822
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cb4bee8
add debugging and make the final write more robust
WilliamHPNielsen 2ba27c7
add test based on bug report
WilliamHPNielsen de080e1
logging: update old loggers
WilliamHPNielsen 93bc564
rename instrument to avoid error in test suite
WilliamHPNielsen 0bfa4fb
save even in case of keyboardinterrupt
WilliamHPNielsen baa18b2
insert argument in all places
WilliamHPNielsen 312c3b7
Merge branch 'master' into fix/datasaving_with_nan_arrays
WilliamHPNielsen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,29 @@ | |
from unittest import TestCase | ||
import numpy as np | ||
from unittest.mock import patch | ||
import os | ||
|
||
from qcodes.loops import Loop | ||
from qcodes.actions import Task, Wait, BreakIf, _QcodesBreak | ||
from qcodes.station import Station | ||
from qcodes.data.data_array import DataArray | ||
from qcodes.instrument.parameter import Parameter | ||
from qcodes.instrument.parameter import Parameter, MultiParameter | ||
from qcodes.utils.validators import Numbers | ||
from qcodes.utils.helpers import LogCapture | ||
|
||
from .instrument_mocks import MultiGetter | ||
from .instrument_mocks import MultiGetter, DummyInstrument | ||
|
||
|
||
class NanReturningParameter(MultiParameter): | ||
|
||
def __init__(self, name, instrument, names=('first', 'second'), | ||
shapes=((), ())): | ||
|
||
super().__init__(name=name, names=names, shapes=shapes, | ||
instrument=instrument) | ||
|
||
def get(self): # this results in a nan-filled DataArray | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. might as well make this get_raw to not get the warning? |
||
return (13,) | ||
|
||
|
||
class TestLoop(TestCase): | ||
|
@@ -21,6 +34,8 @@ def setUpClass(cls): | |
cls.p1 = Parameter('p1', get_cmd=None, set_cmd=None, vals=Numbers(-10, 10)) | ||
cls.p2 = Parameter('p2', get_cmd=None, set_cmd=None, vals=Numbers(-10, 10)) | ||
cls.p3 = Parameter('p3', get_cmd=None, set_cmd=None, vals=Numbers(-10, 10)) | ||
instr = DummyInstrument('dummy') | ||
cls.p4_crazy = NanReturningParameter('p4_crazy', instrument=instr) | ||
Station().set_measurement(cls.p2, cls.p3) | ||
|
||
def test_nesting(self): | ||
|
@@ -93,6 +108,15 @@ def test_repr(self): | |
' Measured | p1 | p1 | (2,)') | ||
self.assertEqual(data.__repr__(), expected) | ||
|
||
def test_measurement_with_many_nans(self): | ||
loop = Loop(self.p1.sweep(0, 1, num=10), | ||
delay=0.05).each(self.p4_crazy) | ||
ds = loop.get_data_set() | ||
loop.run() | ||
|
||
# assert that both the snapshot and the datafile are there | ||
self.assertEqual(len(os.listdir(ds.location)), 2) | ||
|
||
def test_default_measurement(self): | ||
self.p2.set(4) | ||
self.p3.set(5) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a bunch of old style non named loggers in this file. I think we should convert those too