def tests_for_single_bpm(test_sys,
                         data_location,
                         rf_frequency,
                         settling_time=0.1):
    root_path = '/'.join(
        (data_location, test_sys.BPM.mac_address.replace(':', '-'),
         time.strftime("%d-%m-%Y_T_%H-%M")))
    if not os.path.exists(root_path):
        os.makedirs(root_path)

    subdirectory = ''.join((root_path, '/'))

    data_out = {
        'epics_id': test_sys.BPM.epics_id,
        'rf_id': test_sys.rf_id,
        'prog_atten_id': test_sys.prog_atten_id,
        'mac_address': test_sys.BPM.mac_address,
        'first_turn': test_sys.BPM.ft,
        'agc': test_sys.BPM.agc,
        'delta': test_sys.BPM.delta,
        'switches': test_sys.BPM.switches,
        'switch_val': test_sys.BPM.switch_val,
        'attenuation': test_sys.BPM.attn,
        'dsc': test_sys.BPM.dsc,
        'kx': test_sys.BPM.kx,
        'ky': test_sys.BPM.ky,
        'bpm_spec': test_sys.BPM.spec
    }

    with open(subdirectory + "initial_BPM_state.json", 'w') as write_file:
        json.dump(data_out, write_file)

    Tests.adc_test(test_system_object=test_sys,
                   frequency=rf_frequency,
                   output_power_level=-4,
                   settling_time=settling_time,
                   sub_directory=subdirectory)

    Tests.adc_int_atten_sweep_test(test_system_object=test_sys,
                                   frequency=rf_frequency,
                                   output_power_level=-4,
                                   settling_time=settling_time,
                                   sub_directory=subdirectory)

    Tests.beam_power_dependence(test_system_object=test_sys,
                                frequency=rf_frequency,
                                output_power_levels=range(-4, -30, -5),
                                settling_time=settling_time,
                                samples=100,
                                sub_directory=subdirectory)

    Tests.beam_position_equidistant_grid_raster_scan_test(
        test_system_object=test_sys,
        rf_frequency=rf_frequency,
        output_power_level=-6,
        x_points=3,
        y_points=3,
        settling_time=settling_time,
        samples=100,
        sub_directory=subdirectory)
    print '\nData stored in ', subdirectory
    return subdirectory
Beispiel #2
0
#                                          max_power=-40,
#                                          duty_cycles=np.arange(1, 0, -0.1),
#                                          pulse_period=dls_bunch,
#                                          settling_time=settling_time,
#                                          sub_directory=subdirectory
#                                          )

Tests.noise_test(test_system_object=SYS,
                 frequency=dls_RF_frequency,
                 power_levels=np.arange(-20, -50, -5),
                 samples=10,
                 settling_time=settling_time,
                 sub_directory=subdirectory)

Tests.adc_test(test_system_object=SYS,
               frequency=1,
               power_level=-40,
               settling_time=10,
               sub_directory=subdirectory)

Tests.adc_int_atten_sweep_test(test_system_object=SYS,
                               frequency=dls_RF_frequency,
                               power_level=-20,
                               external_attenuation=60,
                               attenuation_levels=np.arange(0, 62, 2),
                               settling_time=settling_time,
                               sub_directory=subdirectory)

Latex_Report.assemble_report(subdirectory=subdirectory)
# report.create_report()