qcodes/data/format.py
def match_save_range(self, group, file_exists, only_complete=True):
        """
        Find the save range that will joins all changes in an array group.

        Matches all full-sized arrays: the data arrays plus the inner loop
        setpoint array.

        Note: if an outer loop has changed values (without the inner
        loop or measured data changing) we won't notice it here. We assume
        that before an iteration of the inner loop starts, the outer loop
        setpoint gets set and then does not change later.

        Args:
            group (Formatter.ArrayGroup): a ``namedtuple`` containing the
                arrays that go together in one file, as tuple ``group.data``.

            file_exists (bool): Does this file already exist? If True, and
                all arrays in the group agree on ``last_saved_index``, we
                assume the file has been written up to this index and we can
                append to it. Otherwise we will set the returned range to start
                from zero (so if the file does exist, it gets completely
                overwritten).

            only_complete (bool): Should we write all available new data,
                or only complete rows? If True, we write only the range of
                array indices which all arrays in the group list as modified,
                so that future writes will be able to do a clean append to
                the data file as more data arrives.
                Default True.

        Returns:
            Tuple(int, int): the first and last raveled indices that should
                be saved. Returns None if:
                    * no data is present
                    * no new data can be found
        """
        inner_setpoint = group.set_arrays[-1]
        full_dim_data = (inner_setpoint, ) + group.data

        # always return None if there are no modifications,
        # even if there are last_saved_index inconsistencies
        # so we don't do extra writing just to reshape the file
        for array in full_dim_data:
            if array.modified_range:
                break
        else:
            return None

        last_saved_index = inner_setpoint.last_saved_index

        if last_saved_index is None or not file_exists:
            if last_saved_index is None and file_exists:
                log.warning("Inconsistent file information. "
                            "last_save_index is None but file exists. "
                            "Will overwrite")
            if last_saved_index is not None and not file_exists:
                log.warning("Inconsistent file information. "
                            "last_save_index is not None but file does not "
                            "exist. Will rewrite from scratch")
            return self._match_save_range_whole_file(
                full_dim_data, only_complete)

        # force overwrite if inconsistent last_saved_index
        for array in group.data:
            if array.last_saved_index != last_saved_index:
                return self._match_save_range_whole_file(
                    full_dim_data, only_complete)

        return self._match_save_range_incremental(
            full_dim_data, last_saved_index, only_complete)

        Find the save range that will joins all changes in an array group.

        Matches all full-sized arrays: the data arrays plus the inner loop
        setpoint array.

        Note: if an outer loop has changed values (without the inner
        loop or measured data changing) we won't notice it here. We assume
        that before an iteration of the inner loop starts, the outer loop
        setpoint gets set and then does not change later.

        Args:
            group (Formatter.ArrayGroup): a ``namedtuple`` containing the
                arrays that go together in one file, as tuple ``group.data``.

            file_exists (bool): Does this file already exist? If True, and
                all arrays in the group agree on ``last_saved_index``, we
                assume the file has been written up to this index and we can
                append to it. Otherwise we will set the returned range to start
                from zero (so if the file does exist, it gets completely
                overwritten).

            only_complete (bool): Should we write all available new data,
                or only complete rows? If True, we write only the range of
                array indices which all arrays in the group list as modified,
                so that future writes will be able to do a clean append to
                the data file as more data arrives.
                Default True.

        Returns:
            Tuple(int, int): the first and last raveled indices that should
                be saved. Returns None if:
                    * no data is present
                    * no new data can be found
        
Find the save range that will joins all changes in an array group.
Matches all full-sized arrays: the data arrays plus the inner loop
setpoint array.

if an outer loop has changed values (without the inner
loop or measured data changing) we won't notice it here. We assume
that before an iteration of the inner loop starts, the outer loop
setpoint gets set and then does not change later.
Find the save range that will joins all changes in an array group . Matches all full - sized arrays : the data arrays plus the inner loop setpoint array . if an outer loop has changed values ( without the inner loop or measured data changing ) we won ' t notice it here . We assume that before an iteration of the inner loop starts the outer loop setpoint gets set and then does not change later .
def match_save_range(self, group, file_exists, only_complete=True):
        inner_setpoint = group.set_arrays[-1]
        full_dim_data = (inner_setpoint, ) + group.data
        for array in full_dim_data:
            if array.modified_range:
                break
        else:
            return None
        last_saved_index = inner_setpoint.last_saved_index
        if last_saved_index is None or not file_exists:
            if last_saved_index is None and file_exists:
                log.warning("Inconsistent file information. "
                            "last_save_index is None but file exists. "
                            "Will overwrite")
            if last_saved_index is not None and not file_exists:
                log.warning("Inconsistent file information. "
                            "last_save_index is not None but file does not "
                            "exist. Will rewrite from scratch")
            return self._match_save_range_whole_file(
                full_dim_data, only_complete)
        for array in group.data:
            if array.last_saved_index != last_saved_index:
                return self._match_save_range_whole_file(
                    full_dim_data, only_complete)
        return self._match_save_range_incremental(
            full_dim_data, last_saved_index, only_complete)
def match_save_range ( self , group , file_exists , only_complete = True ) : inner_setpoint = group . set_arrays [ - 1 ] full_dim_data = ( inner_setpoint , ) + group . data for array in full_dim_data : if array . modified_range : break else : return None last_saved_index = inner_setpoint . last_saved_index if last_saved_index is None or not file_exists : if last_saved_index is None and file_exists : log . warning ( "Inconsistent file information. " "last_save_index is None but file exists. " "Will overwrite" ) if last_saved_index is not None and not file_exists : log . warning ( "Inconsistent file information. " "last_save_index is not None but file does not " "exist. Will rewrite from scratch" ) return self . _match_save_range_whole_file ( full_dim_data , only_complete ) for array in group . data : if array . last_saved_index != last_saved_index : return self . _match_save_range_whole_file ( full_dim_data , only_complete ) return self . _match_save_range_incremental ( full_dim_data , last_saved_index , only_complete )
Find the save range that will joins all changes in an array group.
Find the save range that will joins all changes in an array group .
"""
        Find the save range that will joins all changes in an array group.

        Matches all full-sized arrays: the data arrays plus the inner loop
        setpoint array.

        Note: if an outer loop has changed values (without the inner
        loop or measured data changing) we won't notice it here. We assume
        that before an iteration of the inner loop starts, the outer loop
        setpoint gets set and then does not change later.

        Args:
            group (Formatter.ArrayGroup): a ``namedtuple`` containing the
                arrays that go together in one file, as tuple ``group.data``.

            file_exists (bool): Does this file already exist? If True, and
                all arrays in the group agree on ``last_saved_index``, we
                assume the file has been written up to this index and we can
                append to it. Otherwise we will set the returned range to start
                from zero (so if the file does exist, it gets completely
                overwritten).

            only_complete (bool): Should we write all available new data,
                or only complete rows? If True, we write only the range of
                array indices which all arrays in the group list as modified,
                so that future writes will be able to do a clean append to
                the data file as more data arrives.
                Default True.

        Returns:
            Tuple(int, int): the first and last raveled indices that should
                be saved. Returns None if:
                    * no data is present
                    * no new data can be found
        """ # always return None if there are no modifications, # even if there are last_saved_index inconsistencies # so we don't do extra writing just to reshape the file # force overwrite if inconsistent last_saved_index
Tuple(int, int): the first and last raveled indices that should
be saved. Returns None if:
no data is present
no new data can be found
Tuple ( int int ) : the first and last raveled indices that should be saved . Returns None if : no data is present no new data can be found
self
group
a ``namedtuple`` containing the
arrays that go together in one file, as tuple ``group.data``.
a ` ` namedtuple ` ` containing the arrays that go together in one file as tuple ` ` group . data ` ` .
file_exists
Does this file already exist. If True, and
all arrays in the group agree on ``last_saved_index``, we
assume the file has been written up to this index and we can
append to it. Otherwise we will set the returned range to start
from zero (so if the file does exist, it gets completely
overwritten).
Does this file already exist . If True and all arrays in the group agree on ` ` last_saved_index ` ` we assume the file has been written up to this index and we can append to it . Otherwise we will set the returned range to start from zero ( so if the file does exist it gets completely overwritten ) .
only_complete
Should we write all available new data,
or only complete rows. If True, we write only the range of
array indices which all arrays in the group list as modified,
so that future writes will be able to do a clean append to
the data file as more data arrives.
Default True.
Should we write all available new data or only complete rows . If True we write only the range of array indices which all arrays in the group list as modified so that future writes will be able to do a clean append to the data file as more data arrives . Default True .