How to use the openpathsampling.visualize.SampleList function in openpathsampling

To help you get started, we’ve selected a few openpathsampling examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openpathsampling / openpathsampling / openpathsampling / visualize.py View on Github external
def __getitem__(self, item):
        if type(item) is slice:
            return SampleList(list(self.keys())[item])
        elif isinstance(item, list):
            return [self[s] for s in item]
        elif type(item) is int:
            return list(self.keys())[item]
        else:
            return OrderedDict.__getitem__(self, item)
github openpathsampling / openpathsampling / openpathsampling / visualize.py View on Github external
def __getitem__(self, item):
        if type(item) is slice:
            return SampleList(self.keys()[item])
        elif isinstance(item, list):
            return [self[s] for s in item]
        elif type(item) is int:
            return self.keys()[item]
        else:
            return OrderedDict.__getitem__(self, item)
github openpathsampling / openpathsampling / openpathsampling / visualize.py View on Github external
steps : list of :obj:`openpathsampling.MCStep`
            the list of simulation steps to be inspected and turned into a
            list of samples
        replica : int
            the replica ID to be traced
        accepted : bool
            if `True` only accepted samples will be included in the list.
            Otherwise it will also contain trial samples

        Returns
        -------
        :obj:`SampleList`
            the generated list of samples

        """
        sl = SampleList(SampleList._get_samples_from_steps(
            steps, replica, accepted))
        sl.steps = steps
        return sl
github openpathsampling / openpathsampling / openpathsampling / visualize.py View on Github external
# details=sample.details,
                        parent=sample.parent,
                        mover=sample.mover
                    )

                    parent_list = [current]
                    while current is not parent and current is not None:
                        current = current.parent
                        parent_list.append(current)

                    if current is None:
                        # cannot trace to actual parent. That should not be possible since previously
                        # we found a parent. So just to make sure
                        traj_shift = 0
                    else:
                        missing_sl = SampleList(
                            reversed(parent_list),
                            time_symmetric=self.time_symmetric,
                            flip_time_direction=self.flip_time_direction,
                            trace_missing=False
                        )

                        traj_shift = parent_shift + missing_sl[missing_sl.last]['shift']

                else:
                    traj_shift = 0

                self[sample] = {
                    'shift': traj_shift,
                    'new': True,
                    'time_direction': time_direction,
                    'correlation': 0.0,
github openpathsampling / openpathsampling / openpathsampling / visualize.py View on Github external
steps : list of :obj:`openpathsampling.MCStep`
            the list of simulation steps to be inspected and turned into a
            list of samples
        replica : int
            the replica ID to be traced
        accepted : bool
            if `True` only accepted samples will be included in the list.
            Otherwise it will also contain trial samples

        Returns
        -------
        :obj:`SampleList`
            the generated list of samples

        """
        sl = SampleList(SampleList._get_samples_from_steps(
            steps, replica, accepted))
        sl.steps = steps
        return sl
github openpathsampling / openpathsampling / openpathsampling / visualize.py View on Github external
`.parent` property until no parent is found

        Returns
        -------
        :obj:`SampleList`
            the generated list of samples

        """

        l = []

        while sample is not None:
            l.append(sample)
            sample = sample.parent

        return SampleList(reversed(l))
github openpathsampling / openpathsampling / openpathsampling / visualize.py View on Github external
def without_redundant(self):
        """
        Remove all redundant samples and return a new object

        Redundant samples are samples where the overlap with the previous
        sample is effectively all samples. This depends on the analysis settings
        like `time_symmetric` and `flip_time_direction`

        Returns
        -------
        :obj:`SampleList`
            the generated list of samples


        """
        l = SampleList([
            samp for samp, data in self.iteritems()
            if data['length_shared'] < data['length']])
        l.flip_time_direction = self.flip_time_direction
        l.time_symmetric = self.time_symmetric
        return l
github openpathsampling / openpathsampling / openpathsampling / visualize.py View on Github external
details=sample.details,
                        parent=sample.parent,
                        mover=sample.mover
                    )

                    parent_list = [current]
                    while current is not parent and current is not None:
                        current = current.parent
                        parent_list.append(current)

                    if current is None:
                        # cannot trace to actual parent. That should not be possible since previously
                        # we found a parent. So just to make sure
                        traj_shift = 0
                    else:
                        missing_sl = SampleList(
                            reversed(parent_list),
                            time_symmetric=self.time_symmetric,
                            flip_time_direction=self.flip_time_direction,
                            trace_missing=False
                        )

                        traj_shift = parent_shift + missing_sl[missing_sl.last]['shift']

                else:
                    traj_shift = 0

                self[sample] = {
                    'shift': traj_shift,
                    'new': True,
                    'time_direction': time_direction,
                    'correlation': 0.0,
github openpathsampling / openpathsampling / openpathsampling / visualize.py View on Github external
def without_redundant(self):
        """
        Remove all redundant samples and return a new object

        Redundant samples are samples where the overlap with the previous
        sample is effectively all samples. This depends on the analysis settings
        like `time_symmetric` and `flip_time_direction`

        Returns
        -------
        :obj:`SampleList`
            the generated list of samples


        """
        l = SampleList([
            samp for samp, data in self.items()
            if data['length_shared'] < data['length']])
        l.flip_time_direction = self.flip_time_direction
        l.time_symmetric = self.time_symmetric
        return l