qcodes/measure.py
def run(self, use_threads=False, quiet=False, station=None, **kwargs):
        """
        Run the actions in this measurement and return their data as a DataSet

        Args:
            quiet (Optional[bool]): Set True to not print anything except
                errors. Default False.

            station (Optional[Station]): the ``Station`` this measurement
                pertains to. Defaults to ``Station.default`` if one is defined.
                Only used to supply metadata.

            use_threads (Optional[bool]): whether to parallelize ``get``
                operations using threads. Default False.

            location (Optional[Union[str, bool]]): the location of the
                DataSet, a string whose meaning depends on formatter and io,
                or False to only keep in memory. May be a callable to provide
                automatic locations. If omitted, will use the default
                DataSet.location_provider

            name (Optional[str]): if location is default or another provider
                function, name is a string to add to location to make it more
                readable/meaningful to users

            formatter (Optional[Formatter]): knows how to read and write the
                file format. Default can be set in DataSet.default_formatter

            io (Optional[io_manager]): knows how to connect to the storage
                (disk vs cloud etc)

        location, name formatter and io are passed to ``data_set.new_data``
        along with any other optional keyword arguments.

        returns:
            a DataSet object containing the results of the measurement
        """

        data_set = self._dummyLoop.get_data_set(**kwargs)

        # set the DataSet to local for now so we don't save it, since
        # we're going to massage it afterward
        original_location = data_set.location
        data_set.location = False

        # run the measurement as if it were a Loop
        self._dummyLoop.run(use_threads=use_threads,
                            station=station, quiet=True)

        # look for arrays that are unnecessarily nested, and un-nest them
        all_unnested = True
        for array in data_set.arrays.values():
            if array.ndim == 1:
                if array.is_setpoint:
                    dummy_setpoint = array
                else:
                    # we've found a scalar - so keep the dummy setpoint
                    all_unnested = False
            else:
                # The original return was an array, so take off the extra dim.
                # (This ensures the outer dim length was 1, otherwise this
                # will raise a ValueError.)
                array.ndarray.shape = array.ndarray.shape[1:]

                # TODO: DataArray.shape masks ndarray.shape, and a user *could*
                # change it, thinking they were reshaping the underlying array,
                # but this would a) not actually reach the ndarray right now,
                # and b) if it *did* and the array was reshaped, this array
                # would be out of sync with its setpoint arrays, so bad things
                # would happen. So we probably want some safeguards in place
                # against this
                array.shape = array.ndarray.shape

                array.set_arrays = array.set_arrays[1:]

                array.init_data()

        # Do we still need the dummy setpoint array at all?
        if all_unnested:
            del data_set.arrays[dummy_setpoint.array_id]
            if hasattr(data_set, 'action_id_map'):
                del data_set.action_id_map[dummy_setpoint.action_indices]

        # now put back in the DataSet location and save it
        data_set.location = original_location
        data_set.write()

        # metadata: ActiveLoop already provides station snapshot, but also
        # puts in a 'loop' section that we need to replace with 'measurement'
        # but we use the info from 'loop' to ensure consistency and avoid
        # duplication.
        LOOP_SNAPSHOT_KEYS = ['ts_start', 'ts_end', 'use_threads']
        data_set.add_metadata({'measurement': {
            k: data_set.metadata['loop'][k] for k in LOOP_SNAPSHOT_KEYS
        }})
        del data_set.metadata['loop']

        # actions are included in self.snapshot() rather than in
        # LOOP_SNAPSHOT_KEYS because they are useful if someone just
        # wants a local snapshot of the Measure object
        data_set.add_metadata({'measurement': self.snapshot()})

        data_set.save_metadata()

        if not quiet:
            print(repr(data_set))
            print(datetime.now().strftime('acquired at %Y-%m-%d %H:%M:%S'))

        return data_set

        Run the actions in this measurement and return their data as a DataSet

        Args:
            quiet (Optional[bool]): Set True to not print anything except
                errors. Default False.

            station (Optional[Station]): the ``Station`` this measurement
                pertains to. Defaults to ``Station.default`` if one is defined.
                Only used to supply metadata.

            use_threads (Optional[bool]): whether to parallelize ``get``
                operations using threads. Default False.

            location (Optional[Union[str, bool]]): the location of the
                DataSet, a string whose meaning depends on formatter and io,
                or False to only keep in memory. May be a callable to provide
                automatic locations. If omitted, will use the default
                DataSet.location_provider

            name (Optional[str]): if location is default or another provider
                function, name is a string to add to location to make it more
                readable/meaningful to users

            formatter (Optional[Formatter]): knows how to read and write the
                file format. Default can be set in DataSet.default_formatter

            io (Optional[io_manager]): knows how to connect to the storage
                (disk vs cloud etc)

        location, name formatter and io are passed to ``data_set.new_data``
        along with any other optional keyword arguments.

        returns:
            a DataSet object containing the results of the measurement
        
Run the actions in this measurement and return their data as a DataSet
Run the actions in this measurement and return their data as a DataSet
def run(self, use_threads=False, quiet=False, station=None, **kwargs):
        data_set = self._dummyLoop.get_data_set(**kwargs)
        original_location = data_set.location
        data_set.location = False
        self._dummyLoop.run(use_threads=use_threads,
                            station=station, quiet=True)
        all_unnested = True
        for array in data_set.arrays.values():
            if array.ndim == 1:
                if array.is_setpoint:
                    dummy_setpoint = array
                else:
                    all_unnested = False
            else:
                array.ndarray.shape = array.ndarray.shape[1:]
                array.shape = array.ndarray.shape
                array.set_arrays = array.set_arrays[1:]
                array.init_data()
        if all_unnested:
            del data_set.arrays[dummy_setpoint.array_id]
            if hasattr(data_set, 'action_id_map'):
                del data_set.action_id_map[dummy_setpoint.action_indices]
        data_set.location = original_location
        data_set.write()
        LOOP_SNAPSHOT_KEYS = ['ts_start', 'ts_end', 'use_threads']
        data_set.add_metadata({'measurement': {
            k: data_set.metadata['loop'][k] for k in LOOP_SNAPSHOT_KEYS
        }})
        del data_set.metadata['loop']
        data_set.add_metadata({'measurement': self.snapshot()})
        data_set.save_metadata()
        if not quiet:
            print(repr(data_set))
            print(datetime.now().strftime('acquired at %Y-%m-%d %H:%M:%S'))
        return data_set
def run ( self , use_threads = False , quiet = False , station = None , ** kwargs ) : data_set = self . _dummyLoop . get_data_set ( ** kwargs ) original_location = data_set . location data_set . location = False self . _dummyLoop . run ( use_threads = use_threads , station = station , quiet = True ) all_unnested = True for array in data_set . arrays . values ( ) : if array . ndim == 1 : if array . is_setpoint : dummy_setpoint = array else : all_unnested = False else : array . ndarray . shape = array . ndarray . shape [ 1 : ] array . shape = array . ndarray . shape array . set_arrays = array . set_arrays [ 1 : ] array . init_data ( ) if all_unnested : del data_set . arrays [ dummy_setpoint . array_id ] if hasattr ( data_set , 'action_id_map' ) : del data_set . action_id_map [ dummy_setpoint . action_indices ] data_set . location = original_location data_set . write ( ) LOOP_SNAPSHOT_KEYS = [ 'ts_start' , 'ts_end' , 'use_threads' ] data_set . add_metadata ( { 'measurement' : { k : data_set . metadata [ 'loop' ] [ k ] for k in LOOP_SNAPSHOT_KEYS } } ) del data_set . metadata [ 'loop' ] data_set . add_metadata ( { 'measurement' : self . snapshot ( ) } ) data_set . save_metadata ( ) if not quiet : print ( repr ( data_set ) ) print ( datetime . now ( ) . strftime ( 'acquired at %Y-%m-%d %H:%M:%S' ) ) return data_set
Run the actions in this measurement and return their data as a DataSet
Run the actions in this measurement and return their data as a DataSet
"""
        Run the actions in this measurement and return their data as a DataSet

        Args:
            quiet (Optional[bool]): Set True to not print anything except
                errors. Default False.

            station (Optional[Station]): the ``Station`` this measurement
                pertains to. Defaults to ``Station.default`` if one is defined.
                Only used to supply metadata.

            use_threads (Optional[bool]): whether to parallelize ``get``
                operations using threads. Default False.

            location (Optional[Union[str, bool]]): the location of the
                DataSet, a string whose meaning depends on formatter and io,
                or False to only keep in memory. May be a callable to provide
                automatic locations. If omitted, will use the default
                DataSet.location_provider

            name (Optional[str]): if location is default or another provider
                function, name is a string to add to location to make it more
                readable/meaningful to users

            formatter (Optional[Formatter]): knows how to read and write the
                file format. Default can be set in DataSet.default_formatter

            io (Optional[io_manager]): knows how to connect to the storage
                (disk vs cloud etc)

        location, name formatter and io are passed to ``data_set.new_data``
        along with any other optional keyword arguments.

        returns:
            a DataSet object containing the results of the measurement
        """ # set the DataSet to local for now so we don't save it, since # we're going to massage it afterward # run the measurement as if it were a Loop # look for arrays that are unnecessarily nested, and un-nest them # we've found a scalar - so keep the dummy setpoint # The original return was an array, so take off the extra dim. # (This ensures the outer dim length was 1, otherwise this # will raise a ValueError.) # TODO: DataArray.shape masks ndarray.shape, and a user *could* # change it, thinking they were reshaping the underlying array, # but this would a) not actually reach the ndarray right now, # and b) if it *did* and the array was reshaped, this array # would be out of sync with its setpoint arrays, so bad things # would happen. So we probably want some safeguards in place # against this # Do we still need the dummy setpoint array at all? # now put back in the DataSet location and save it # metadata: ActiveLoop already provides station snapshot, but also # puts in a 'loop' section that we need to replace with 'measurement' # but we use the info from 'loop' to ensure consistency and avoid # duplication. # actions are included in self.snapshot() rather than in # LOOP_SNAPSHOT_KEYS because they are useful if someone just # wants a local snapshot of the Measure object
self
use_threads
whether to parallelize ``get``
operations using threads. Default False.
whether to parallelize ` ` get ` ` operations using threads . Default False .
quiet
Set True to not print anything except
errors. Default False.
Set True to not print anything except errors . Default False .
station
the ``Station`` this measurement
pertains to. Defaults to ``Station.default`` if one is defined.
Only used to supply metadata.
the ` ` Station ` ` this measurement pertains to . Defaults to ` ` Station . default ` ` if one is defined . Only used to supply metadata .
location
the location of the
DataSet, a string whose meaning depends on formatter and io,
or False to only keep in memory. May be a callable to provide
automatic locations. If omitted, will use the default
DataSet.location_provider
the location of the DataSet a string whose meaning depends on formatter and io or False to only keep in memory . May be a callable to provide automatic locations . If omitted will use the default DataSet . location_provider
name
if location is default or another provider
function, name is a string to add to location to make it more
readable/meaningful to users
if location is default or another provider function name is a string to add to location to make it more readable / meaningful to users
formatter
knows how to read and write the
file format. Default can be set in DataSet.default_formatter
knows how to read and write the file format . Default can be set in DataSet . default_formatter
io
knows how to connect to the storage
(disk vs cloud etc)
knows how to connect to the storage ( disk vs cloud etc )