********************************************************* ** Welcome to the verbose configuration DB demo script ** ********************************************************* First let's take a peak at what run information looks like for one run. Let's choose run 2873 since that's included within MAUS. We do this by first setting up the configuration DB interface: beamline = Beamline() which was easy enough. You can check that the beamline class was set up correctly by running: get_status()' which should return OK (returns: %s).' % beamline.get_status() So now let's get something useful. How about the setup our run: print beamline.get_beamline_for_run(2873) { 2873L: { 'beam_stop': 'Closed', 'daq_gate_width': 0.0, 'daq_trigger': 'TOF0', 'daq_version': '6.5', 'diffuser_thickness': 0, 'end_notes': None, 'end_pulse': 564490L, 'end_time': datetime.datetime(2010, 8, 14, 17, 48, 21, 259052), 'gdc_host_name': None, 'isis_beam': { }, 'ldc_host_names': [], 'magnets': { 'd1': { 'polarity': None, 'set_current': 323.15}, 'd2': { 'polarity': None, 'set_current': 94.15}, 'ds': { 'polarity': None, 'set_current': 669.0}, 'q1': { 'polarity': None, 'set_current': 102.38}, 'q2': { 'polarity': None, 'set_current': 127.91}, 'q3': { 'polarity': None, 'set_current': 89.0}, 'q4': { 'polarity': None, 'set_current': 158.1}, 'q5': { 'polarity': None, 'set_current': 212.02}, 'q6': { 'polarity': None, 'set_current': 140.57}, 'q7': { 'polarity': None, 'set_current': 138.67}, 'q8': { 'polarity': None, 'set_current': 209.82}, 'q9': { 'polarity': None, 'set_current': 179.18}}, 'optics': 'mu+', 'proton_absorber_thickness': 0, 'run_number': 2873L, 'run_type': None, 'scalars': { }, 'start_notes': 'NULL', 'start_pulse': 564087L, 'start_time': datetime.datetime(2010, 8, 14, 17, 31, 9, 219158), 'status': True, 'step': 1.0}} We can also ask what the runs were for a certain date range: date0 = datetime.strptime("2009-01-01", "%Y-%m-%d") date1 = datetime.strptime("2010-12-12", "%Y-%m-%d") run_info = beamline.get_beamlines_for_dates(date0, date1) print run_info.keys() [2613L, 2614L, 2615L, 2616L, 2617L, 2618L, 2627L, 2628L, 2629L, 2630L, 2631L, 2632L, 2633L, 2634L, 2635L, 2636L, 2637L, 2638L, 2639L, 2640L, 2641L, 2642L, 2643L, 2644L, 2645L, 2646L, 2647L, 2648L, 2649L, 2650L, 2651L, 2652L, 2653L, 2654L, 2655L, 2656L, 2658L, 2659L, 2660L, 2661L, 2662L, 2663L, 2664L, 2665L, 2666L, 2667L, 2668L, 2669L, 2670L, 2671L, 2672L, 2673L, 2674L, 2675L, 2676L, 2677L, 2678L, 2679L, 2680L, 2682L, 2683L, 2684L, 2685L, 2686L, 2687L, 2688L, 2689L, 2690L, 2691L, 2694L, 2695L, 2699L, 2700L, 2701L, 2702L, 2703L, 2704L, 2705L, 2706L, 2707L, 2708L, 2709L, 2710L, 2711L, 2712L, 2713L, 2714L, 2715L, 2716L, 2717L, 2718L, 2719L, 2720L, 2721L, 2722L, 2723L, 2727L, 2728L, 2729L, 2730L, 2731L, 2732L, 2733L, 2734L, 2735L, 2736L, 2737L, 2738L, 2739L, 2740L, 2741L, 2743L, 2744L, 2745L, 2746L, 2747L, 2748L, 2749L, 2750L, 2751L, 2752L, 2753L, 2754L, 2755L, 2756L, 2759L, 2760L, 2761L, 2762L, 2763L, 2764L, 2765L, 2766L, 2767L, 2768L, 2769L, 2770L, 2771L, 2773L, 2774L, 2775L, 2776L, 2777L, 2778L, 2779L, 2780L, 2781L, 2782L, 2783L, 2784L, 2785L, 2786L, 2787L, 2788L, 2789L, 2790L, 2791L, 2792L, 2793L, 2794L, 2795L, 2796L, 2797L, 2798L, 2799L, 2800L, 2801L, 2803L, 2804L, 2805L, 2806L, 2807L, 2808L, 2809L, 2810L, 2811L, 2812L, 2817L, 2818L, 2819L, 2820L, 2821L, 2824L, 2825L, 2826L, 2828L, 2829L, 2830L, 2831L, 2832L, 2834L, 2835L, 2836L, 2837L, 2838L, 2839L, 2840L, 2841L, 2842L, 2843L, 2844L] where the .keys() stuff only prints the run number since the data- type is a dictionary. Let's say you want the magnet current for a certain run:" my_runs = beamline.get_beamline_for_run(2873)" print my_runs[2873]['magnets']['d1']['set_current']" 323.15 Lastly you can search by target pulses:' get_beamlines_for_pulses(565665,565864).keys() [2879L] and you can find more information about the configuration DB' interface by checking the interactive help on the python command line help(cdb)