summarize_stats

xpolbeamline.sitkconverter.summarize_stats(start, exptime, stats, maxtdiff=<Quantity 5.0 s>)[source]

Find entries in statsfile for a specific dataset and summarize them.

For numeric values, this just returns the mean of all rows in the statsfile which overlap the exposure. Current is treated special and this returns also the range of currents.

Parameters:

start : astropy.time.Time

Start time of exposure

exptime : astropy.units.quantity.Quantity

Exposure duration

stats : string

Path and filename to a stats file or path to a directory of statsfiles. In the second case, this function will look for a file following the naming convention stats_MM_DD_YY.txt in the given directory. If such a file does not exist, all files with names starting with stats_ will be searched for overlap with the exposure.

maxtdiff : astropy.units.quantity.Quantity

Statsfiles are required to have entries within this time of the exposure start and finish. This number should be set to a time slightly longer than the time step size in the stats files.

Returns:

out : dict

Dictionary where values are tuples consisting of a string and a comment