aboutsummaryrefslogtreecommitdiff
path: root/qolab/hardware/scope/__init__.py
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-05 12:55:35 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-05 12:55:35 -0500
commit9292c084167c93aacbe33050ce4bceb95f07de4a (patch)
treec13e6a7e166a831446232eae36fc58c2311d7841 /qolab/hardware/scope/__init__.py
parentc5323dcc6a151616696eaa8dce5cf09f777a5f90 (diff)
downloadqolab-9292c084167c93aacbe33050ce4bceb95f07de4a.tar.gz
qolab-9292c084167c93aacbe33050ce4bceb95f07de4a.zip
added save protocol for basic scope
Diffstat (limited to 'qolab/hardware/scope/__init__.py')
-rw-r--r--qolab/hardware/scope/__init__.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/qolab/hardware/scope/__init__.py b/qolab/hardware/scope/__init__.py
index 8face45..46898ac 100644
--- a/qolab/hardware/scope/__init__.py
+++ b/qolab/hardware/scope/__init__.py
@@ -4,12 +4,15 @@ Created by Eugeniy E. Mikhailov 2021/11/29
"""
from qolab.hardware.scpi import SCPIinstr
from qolab.data.trace import TraceSetSameX
+from qolab.file_utils import get_next_data_file
class Scope:
# Minimal set of methods to be implemented by a scope.
def __init__(self):
self.numberOfChannels = 0
+ self.fname_prefix = 'scope'
+ self.savepath = './scope'
def getTrace(self, chNum, availableNpnts=None, maxRequiredPoints=None):
# Should work with minimal arguments list
@@ -22,6 +25,13 @@ class Scope:
allTraces.addTrace( self.getTrace(chNum, availableNpnts, maxRequiredPoints) )
return( allTraces )
+ def save(self, fname=None, item_format='e', availableNpnts=None, maxRequiredPoints=None, extention='dat'):
+ allTraces = self.getAllTraces(availableNpnts=availableNpnts, maxRequiredPoints=maxRequiredPoints)
+ if fname is None:
+ fname = get_next_data_file(self.fname_prefix, self.savepath, extention=extention)
+ allTraces.save(fname, item_format=item_format)
+ return(fname)
+
class ScopeSCPI(SCPIinstr, Scope):
"""