Skip to content

Commit

Permalink
Merge branch 'qkitgroup:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius-Frohn authored Aug 6, 2024
2 parents 58c1c83 + 0f59e72 commit fa02b27
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ dist/

# Legacy qkit folder logs
qkit/logs

# Data folders

qkit/data/*
data/*
src/qkit/data/*
7 changes: 3 additions & 4 deletions src/qkit/core/instrument_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import qkit.core.instrument_base as instrument

import importlib
from imp import reload # this is needed for py3


from qkit.core.lib.misc import get_traceback
Expand All @@ -39,7 +38,7 @@ def _get_driver_module(name, do_reload=False):
try:
mod = importlib.import_module(name)
if do_reload:
reload(mod)
importlib.reload(mod)
except ImportError as e:
fields = str(e).split(' ')
if len(fields) > 0 and fields[-1] == name:
Expand Down Expand Up @@ -233,7 +232,7 @@ def create(self, name, instype, **kwargs):
if module is None:
return self._create_invalid_ins(name, instype, **kwargs)

reload(module)
importlib.reload(module)

insclass = getattr(module, instype, None)
if insclass is None:
Expand Down Expand Up @@ -323,7 +322,7 @@ def auto_load(self, driver):
module = _get_driver_module(driver)
if module is None:
return False
reload(module)
importlib.reload(module)

if not hasattr(module, 'detect_instruments'):
logging.warning('Driver does not support instrument detection')
Expand Down
3 changes: 2 additions & 1 deletion src/qkit/measure/transport/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ def _numerical_derivative(self, x, y):
# TODO: catch error, if len(dataset) < window_length in case of SavGol filter
try:
return self._numder_func(y, *self._numder_args, **self._numder_kwargs)/self._numder_func(x, *self._numder_args, **self._numder_kwargs)
except:
except Exception as e:
logging.warning("Can't calculate numerical derivative, possibly insufficient data points. %s", e)
return np.zeros(len(y))*np.nan

def set_x_dt(self, x_dt):
Expand Down
10 changes: 4 additions & 6 deletions src/qkit/storage/hdf_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,10 @@ def append(self,ds,data, next_matrix=False, reset=False, pointwise=False):
if dim0 == 1:
fill[0] = 1
dim1 += 1
if reset:
ds[fill[0]-1,fill[1]-2] = data # reset overwrites last data series
else: # standard reset = False
ds.resize((dim0,dim1,len(data)))
fill[1] += 1
ds[fill[0]-1,fill[1]-1] = data
if not reset: # standard reset = False
ds.resize((dim0,dim1,len(data))) # Update array size
fill[1] += 1 # Update write position
ds[fill[0]-1,fill[1]-1] = data # Our indices start with one.
ds.attrs.modify("fill", fill)

self.flush()
Expand Down

0 comments on commit fa02b27

Please sign in to comment.