Ignore:
Timestamp:
Aug 18, 2017 9:14:43 AM (4 years ago)
Author:
odonnell
Message:

refactor do_refinements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIscriptable.py

    r3012 r3015  
    937937
    938938    def do_refinements(self, refinements, histogram='all', phase='all',
    939                        outputnames=None):
    940         """Conducts a series of refinements.
     939                       outputnames=None, makeBack=False):
     940        """Conducts a series of refinements. Wrapper around iter_refinements
     941
     942        :param list refinements: A list of dictionaries defining refinements
     943        :param str histogram: Name of histogram for refinements to be applied
     944            to, or 'all'
     945        :param str phase: Name of phase for refinements to be applied to, or
     946            'all'
     947        """
     948        for proj in self.iter_refinements(refinements, histogram, phase,
     949                                          outputnames, makeBack):
     950            pass
     951        return self
     952
     953    def iter_refinements(self, refinements, histogram='all', phase='all',
     954                         outputnames=None, makeBack=False):
     955        """Conducts a series of refinements, iteratively. Stops after every
     956        refinement and yields this project, to allow error checking or
     957        logging of intermediate results.
     958
     959        >>> def checked_refinements(proj):
     960        ...     for p in proj.iter_refinements(refs):
     961        ...         # Track intermediate results
     962        ...         log(p.histogram('0').residuals)
     963        ...         log(p.phase('0').get_cell())
     964        ...         # Check if parameter diverged, nonsense answer, or whatever
     965        ...         if is_something_wrong(p):
     966        ...             raise Exception("I need a human!")
    941967
    942968        :param list refinements: A list of dictionaries defining refinements
     
    964990                self.save(output)
    965991
    966             self.refine()  # newFile=output)
     992            self.refine(makeBack=makeBack)
     993            yield self
    967994
    968995            # Handle 'once' args - refinements that are disabled after this
     
    12391266                for key in ['R', 'Rb', 'wR', 'wRb', 'wRmin']}
    12401267
     1268    # TODO Figure out G2obj.HistRanIdLookup reload
    12411269    @property
    12421270    def id(self):
Note: See TracChangeset for help on using the changeset viewer.