fabio.file_series

Package fabio :: Module file_series |
[hide private]
[frames] | no frames]

# Module file_series

source code

    Authors:
    ........

    * Henning O. Sorensen & Erik Knudsen
      Center for Fundamental Research: Metal Structures in Four Dimensions
      Risoe National Laboratory
      Frederiksborgvej 399
      DK-4000 Roskilde
      email:erik.knudsen@risoe.dk
    * Jon Wright, ESRF

Classes | [hide private]
| file_series Represents a series of files to iterate has an idea of a current position to do next and prev
| numbered_file_series mydata0001.edf = "mydata" + 0001 + ".edf" mydata0002.edf = "mydata" + 0002 + ".edf" mydata0003.edf = "mydata" + 0003 + ".edf"
| filename_series Much like the others, but created from a string filename

Functions | [hide private]
new_file_series0(first_object, first=None, last=None, step=1) Created from a fabio image first and last are file numbers | source code
new_file_series(first_object, nimages=0, step=1, traceback=False) A generator function that creates a file series starting from a a fabioimage. | source code

Variables | [hide private]
| logger = `logging.getLogger("fileseries")`
| __package__ = ``'``fabio``'``

Function Details | [hide private]

### new_file_series(first_object, nimages=0, step=1, traceback=False) | source code
    A generator function that creates a file series starting from a a fabioimage.
    Iterates through all images in a file (if more than 1), then proceeds to
    the next file as determined by fabio.next_filename.

    @param first_object: the starting fabioimage, which will be the first one yielded
        in the sequence
    @param nimages:  the maximum number of images to consider
        step: step size, will yield the first and every step'th image until nimages
        is reached.  (e.g. nimages = 5, step = 2 will yield 3 images (0, 2, 4)
    @param traceback: if True causes it to print a traceback in the event of an
        exception (missing image, etc.).  Otherwise the calling routine can handle
        the exception as it chooses
    @param yields: the next fabioimage in the series.
        In the event there is an exception, it yields the sys.exec_info for the
        exception instead.  sys.exec_info is a tuple:
        ( exceptionType, exceptionValue, exceptionTraceback )
        from which all the exception information can be obtained.

    Suggested usage:

    ::

        for obj in new_file_series( ... ):
          if not isinstance(obj, fabio.fabioimage.fabioimage ):
            # deal with errors like missing images, non readable files, etc
            # e.g.
            traceback.print_exception(obj[0], obj[1], obj[2])