def cycles_per_trial(nwb):
    """Get the number of microscope cycles/trial.

    That is, the number of times each point is imaged in each
    trial. Currently looks at the first imaging timeseries in
    the first trial, and assumes they're all the same.
    """
    trial1 = nwb['/epochs/trial_0001']
    for ts_name in trial1:
        ts = trial1[ts_name]
        is_image_series = ts['timeseries/pixel_time_offsets'] is not None
        if is_image_series:
            return ts['count'].value
    else:
        raise ValueError('No imaging timeseries found')