Esempio n. 1
0
    def save(self, filename=None):
        """Save the |Experiment| to disk.

        Parameters
        ----------
        filename : str, optional
            If specified, overrides |Experiment.filename|.

        """
        filename = filename or self.filename
        if filename:
            logger.debug('Saving Experiment instance to {}.'.format(filename))
            with open(filename, 'w') as f:
                yaml.dump(self, f)

        else:
            logger.warning('Cannot save experiment: No filename provided.')
Esempio n. 2
0
    def save(self, filename=None):
        """Save the |Experiment| to disk.

        Parameters
        ----------
        filename : str, optional
            If specified, overrides |Experiment.filename|.

        """
        filename = filename or self.filename
        if filename:
            logger.debug('Saving Experiment instance to {}.'.format(filename))
            with open(filename, 'w') as f:
                yaml.dump(self, f)

        else:
            logger.warning('Cannot save experiment: No filename provided.')
Esempio n. 3
0
def test_round_trip(data):
    cmp = yaml.load(yaml.dump(data)) == data
    if isinstance(cmp, np.ndarray):
        assert np.all(cmp)
    else:
        assert cmp
Esempio n. 4
0
def test_round_trip(data):
    cmp = yaml.load(yaml.dump(data)) == data
    if isinstance(cmp, np.ndarray):
        assert np.all(cmp)
    else:
        assert cmp