コード例 #1
0
def save_new_object(folder,
                    test,
                    cam,
                    ambient_folder='ambient/',
                    dark_folder='dark/'):
    print 'saving new object'
    images = image_list(folder + test + '/' + cam + '_')

    ambient = image_list(folder + ambient_folder + cam + '_')
    dark = image_list(folder + dark_folder + cam + '_')

    im_obj = FiberImage(images, dark=dark, ambient=ambient, camera=cam)
    im_obj.save_image(image_file(folder, test, cam))
    im_obj.save_object(object_file(folder, test, cam))
コード例 #2
0
def main():
    num_images = 1
    interval = 1
    max_image = 10
    cam = 'nf'
    # folder = '../data/modal_noise/Kris_data/rectangular_100x300um/baseline/'
    # folder = '../data/modal_noise/rv_error/coupled_ag_new/'
    folder = '../data/modal_noise/rec_fiber_freq_tests/agitated_15volts_120mm_2s/'
    # folder = '../data/stability/2017-03-19 Stability Test/circular_200um/'
    # ambient = image_list(folder + '../ambient_2s/' + cam + '_')
    ambient = None
    # dark = image_list(folder + 'dark/' + cam + '_')
    dark = None

    # with imageio.get_writer(folder + cam + '_' + str(num_images) + '.gif', mode='I') as writer:
    with imageio.get_writer(folder + cam + '_snr.gif', mode='I') as writer:
        for i in xrange(0, max_image, interval):
            # images = image_list(folder + cam + '_', num=num_images, start=i)
            images = image_list(folder + cam + '_', num=i+1, start=0)

            image = FiberImage(images, ambient=ambient, dark=dark, camera=cam)

            print images[-1]
            writer.append_data(image.get_image())
コード例 #3
0
def output_files(folder, f):
    return image_list(folder + 'output_' + str(f) + '/ff_')
コード例 #4
0
def ambient_files(folder):
    return image_list(folder + 'ambient/ff_')
コード例 #5
0
def dark_files(folder):
    return image_list(folder + 'dark/ff_')
コード例 #6
0
def image_list_frd(image_name, f_ratios, **kwargs):
    return [
        image_list(image_name + str(f) + '/im_', **kwargs) for f in f_ratios
    ]
コード例 #7
0
from fiber_properties import FiberImage, image_list, show_image_array

folder = '../data/scrambling/2016-08-05 Prototype Core Extension 1/'
dark_folder = folder + 'Dark/'
ambient_folder = folder + 'Ambient/'

in_images = image_list(ambient_folder + 'in_')
nf_images = image_list(ambient_folder + 'nf_')
ff_images = image_list(ambient_folder + 'ff_')

print 'input'
for image in in_images:
    print FiberImage(image, camera='in',
                     ambient=in_images).get_fiber_centroid(method='full',
                                                           units='pixels')
print
print 'near field'
for image in nf_images:
    nf_obj = FiberImage(image, camera='nf')
    print nf_obj.get_fiber_centroid(method='full', units='pixels')
print
print 'far field'
for image in ff_images:
    ff_obj = FiberImage(image, camera='ff')
    print ff_obj.get_fiber_centroid(method='full', units='pixels')
コード例 #8
0
from fiber_properties import FiberImage, image_list

obj = FiberImage(image_list('pos_1/nf_'),
                 ambient=image_list('../ambient/nf_'),
                 camera='ff')

print obj.get_fiber_center(method='rectangle', show_image=True)
コード例 #9
0
from fiber_properties import (scrambling_gain, image_list,
                              plot_scrambling_gain_input_output,
                              plot_scrambling_gain, save_plot, show_plots,
                              load_image_object, FiberImage)

NEW_DATA = False
FOLDER = '../data/EXPRES/rectangular_132/scrambling/'
POSITIONS = ['pos_1', 'pos_2', 'pos_3', 'pos_4', 'pos_5']

if __name__ == '__main__':

    if NEW_DATA:
        from fiber_properties import FiberImage

        in_dark = image_list(FOLDER + '../dark/in_')
        in_ambient = image_list(FOLDER + '../ambient/in_')
        nf_dark = image_list(FOLDER + '../dark/nf_')
        nf_ambient = image_list(FOLDER + '../ambient/nf_')
        ff_dark = image_list(FOLDER + '../dark/ff_')
        ff_ambient = image_list(FOLDER + '../ambient/ff_')

        for pos in POSITIONS:
            print 'Initializing ' + pos
            in_images = image_list(FOLDER + pos + '/in_')
            nf_images = image_list(FOLDER + pos + '/nf_')
            ff_images = image_list(FOLDER + pos + '/ff_')

            FiberImage(in_images, in_dark, in_ambient, camera='in').save()
            FiberImage(nf_images, nf_dark, nf_ambient, camera='nf').save()
            FiberImage(ff_images, ff_dark, ff_ambient, camera='ff').save()
コード例 #10
0
from fiber_properties import FiberImage, image_list

obj = FiberImage(image_list('pos_1/nf_'),
                    ambient=image_list('../ambient/nf_'),
                    camera='ff')

print obj.get_fiber_center(method='rectangle', show_image=True)
コード例 #11
0
def output_files(folder, f):
    return image_list(folder + 'Output ' + str(f) + '/im_')
コード例 #12
0
def input_files(folder, f):
    return image_list(folder + 'Input ' + str(f) + '/im_')
コード例 #13
0
def ambient_files(folder):
    return image_list(folder + 'Ambient/im_')
コード例 #14
0
def dark_files(folder):
    return image_list(folder + 'Dark/im_')
コード例 #15
0
#==== Modal Noise Test =======================================================#
#=============================================================================#

if __name__ == '__main__':
    from fiber_properties import FiberImage, image_list, plot_fft

    base_folder = '../data/Modal Noise Measurements/2016-07-26/'
    ambient_folder = base_folder + 'ambient/600um/'
    dark_folder = base_folder + 'dark/'
    agitated_folder = base_folder + 'images/600um/agitated/'
    unagitated_folder = base_folder + 'images/600um/unagitated/'

    nf = {}
    ff = {}

    nf_dark = image_list(dark_folder + 'nf_dark_')
    nf_ambient = image_list(ambient_folder + 'nf_ambient_')
    ff_dark = image_list(dark_folder + 'ff_dark_')
    ff_ambient = image_list(ambient_folder + 'ff_ambient_')

    nf_agitated = FiberImage(image_list(agitated_folder + 'nf_agitated_'),
                             nf_dark, nf_ambient)
    nf_unagitated = FiberImage(
        image_list(unagitated_folder + 'nf_unagitated_'), nf_dark, nf_ambient)
    nf_baseline = FiberImage(nf_agitated.get_tophat_fit(),
                             pixel_size=nf_agitated.get_pixel_size(),
                             threshold=0.1,
                             camera='nf')

    ff_agitated = FiberImage(image_list(agitated_folder + 'ff_agitated_'),
                             ff_dark, ff_ambient)
コード例 #16
0
from fiber_properties import (scrambling_gain, image_list,
                              plot_scrambling_gain_input_output,
                              plot_scrambling_gain, save_plot, show_plots,
                              load_image_object, FiberImage)

NEW_DATA = False
FOLDER = '../data/EXPRES/rectangular_132/scrambling/'
POSITIONS = ['pos_1', 'pos_2', 'pos_3', 'pos_4', 'pos_5']

if __name__ == '__main__':

    if NEW_DATA:
        from fiber_properties import FiberImage

        in_dark = image_list(FOLDER + '../dark/in_')
        in_ambient = image_list(FOLDER + '../ambient/in_')
        nf_dark = image_list(FOLDER + '../dark/nf_')
        nf_ambient = image_list(FOLDER + '../ambient/nf_')
        ff_dark = image_list(FOLDER + '../dark/ff_')
        ff_ambient = image_list(FOLDER + '../ambient/ff_')

        for pos in POSITIONS:
            print 'Initializing ' + pos
            in_images = image_list(FOLDER + pos + '/in_')
            nf_images = image_list(FOLDER + pos + '/nf_')
            ff_images = image_list(FOLDER + pos + '/ff_')

            FiberImage(in_images, in_dark, in_ambient, camera='in').save()
            FiberImage(nf_images, nf_dark, nf_ambient, camera='nf').save()
            FiberImage(ff_images, ff_dark, ff_ambient, camera='ff').save()
コード例 #17
0
from fiber_properties import (scrambling_gain, image_list,
                              plot_scrambling_gain_input_output,
                              plot_scrambling_gain, save_plot, show_plots,
                              load_image_object, FiberImage)

if __name__ == '__main__':

    NEW_DATA = False
    folder = '../data/scrambling/2016-08-05 Prototype Core Extension 1/'

    if NEW_DATA:
        from fiber_properties import FiberImage

        in_dark = image_list(folder + 'Dark/in_')
        in_ambient = image_list(folder + 'Ambient/in_')
        nf_dark = image_list(folder + 'Dark/nf_')
        nf_ambient = image_list(folder + 'Ambient/nf_')
        ff_dark = image_list(folder + 'Dark/ff_')
        ff_ambient = image_list(folder + 'Ambient/ff_')

        for shift in ['00', '05', '10', '15', '20', '25', '30']:
            print 'Initializing Shift ' + shift
            in_images = image_list(folder + 'Shift_' + shift + '/in_')
            nf_images = image_list(folder + 'Shift_' + shift + '/nf_')
            ff_images = image_list(folder + 'Shift_' + shift + '/ff_')

            FiberImage(in_images, in_dark, in_ambient, camera='in').save()
            FiberImage(nf_images, nf_dark, nf_ambient, camera='nf').save()
            FiberImage(ff_images, ff_dark, ff_ambient, camera='ff').save()

    shifts = ['00', '05', '10', '15', '20', '25', '30']
コード例 #18
0
from fiber_properties import (scrambling_gain, image_list,
                              plot_scrambling_gain_input_output,
                              plot_scrambling_gain, save_plot, show_plots,
                              load_image_object, FiberImage)

if __name__ == '__main__':

    NEW_DATA = False
    folder = '../data/scrambling/2016-08-05 Prototype Core Extension 1/'

    if NEW_DATA:
        from fiber_properties import FiberImage

        in_dark = image_list(folder + 'Dark/in_')
        in_ambient = image_list(folder + 'Ambient/in_')
        nf_dark = image_list(folder + 'Dark/nf_')
        nf_ambient = image_list(folder + 'Ambient/nf_')
        ff_dark = image_list(folder + 'Dark/ff_')
        ff_ambient = image_list(folder + 'Ambient/ff_')

        for shift in ['00', '05', '10', '15', '20', '25', '30']:
            print 'Initializing Shift ' + shift
            in_images = image_list(folder + 'Shift_' + shift + '/in_')
            nf_images = image_list(folder + 'Shift_' + shift + '/nf_')
            ff_images = image_list(folder + 'Shift_' + shift + '/ff_')

            FiberImage(in_images, in_dark, in_ambient, camera='in').save()
            FiberImage(nf_images, nf_dark, nf_ambient, camera='nf').save()
            FiberImage(ff_images, ff_dark, ff_ambient, camera='ff').save()

    shifts = ['00', '05', '10', '15', '20', '25', '30']
コード例 #19
0
from fiber_properties import FiberImage, image_list, show_image_array

folder = '../data/scrambling/2016-08-05 Prototype Core Extension 1/'
dark_folder = folder + 'Dark/'
ambient_folder = folder + 'Ambient/'

in_images = image_list(ambient_folder + 'in_')
nf_images = image_list(ambient_folder + 'nf_')
ff_images = image_list(ambient_folder + 'ff_')

print 'input'
for image in in_images:
    print FiberImage(image, camera='in', ambient=in_images).get_fiber_centroid(method='full', units='pixels')
print
print 'near field'
for image in nf_images:
    nf_obj = FiberImage(image, camera='nf')
    print nf_obj.get_fiber_centroid(method='full', units='pixels')
print
print 'far field'
for image in ff_images:
    ff_obj = FiberImage(image, camera='ff')
    print ff_obj.get_fiber_centroid(method='full', units='pixels')
コード例 #20
0
#==== Modal Noise Test =======================================================#
#=============================================================================#

if __name__ == '__main__':
    from fiber_properties import FiberImage, image_list, plot_fft

    base_folder = '../data/Modal Noise Measurements/2016-07-26/'
    ambient_folder = base_folder + 'ambient/600um/'
    dark_folder = base_folder + 'dark/'
    agitated_folder = base_folder + 'images/600um/agitated/'
    unagitated_folder = base_folder + 'images/600um/unagitated/'

    nf = {}
    ff = {}

    nf_dark = image_list(dark_folder + 'nf_dark_')
    nf_ambient = image_list(ambient_folder + 'nf_ambient_')
    ff_dark = image_list(dark_folder + 'ff_dark_')
    ff_ambient = image_list(ambient_folder + 'ff_ambient_')

    nf_agitated = FiberImage(image_list(agitated_folder + 'nf_agitated_'),
                                nf_dark, nf_ambient)
    nf_unagitated = FiberImage(image_list(unagitated_folder + 'nf_unagitated_'),
                                  nf_dark, nf_ambient)
    nf_baseline = FiberImage(nf_agitated.get_tophat_fit(),
                                pixel_size=nf_agitated.get_pixel_size(),
                                threshold=0.1, camera='nf')

    ff_agitated = FiberImage(image_list(agitated_folder + 'ff_agitated_'),
                                ff_dark, ff_ambient)
    ff_unagitated = FiberImage(image_list(unagitated_folder + 'ff_unagitated_'),