# Test script for multi period acquisition and saving. # latest mods 21 Oct 09 based on info from Ferdi - ajs set n_periods 1 proc open_hist_file {} { newfile HISTOGRAM_XY } proc histset_XY {} { set histstr "proc open_hist_file {} {newfile HISTOGRAM_XY}" eval $histstr } proc histset_XYperiod {} { set histstr "proc open_hist_file {} {newfile HISTOPERIOD_XY}" eval $histstr } proc histset_XYT {} { set histstr "proc open_hist_file {} {newfile HISTOGRAM_XYT}" eval $histstr } proc histset_XYTperiod {} { set histstr "proc open_hist_file {} {newfile HISTOPERIOD_XYT}" } proc histmem_period_single { } { # Because bugs may not yet have been corrected in hmm_configuration_common_1.tcl, # apply the default settings before attempting del/clear. histmem astop global n_periods set n_periods 1 FAT_TABLE -set NOS_PERIODS 1 # FAT_TABLE -del NOS_PERIODS # BAT_TABLE -set PERIOD_INDICES { 0 } NO_BAT_ENTRIES 1 NO_BAT_PERIODS 1 NO_REPEAT_ENTRY 0 NO_REPEAT_TABLE 0 NO_EXECUTE_TABLE 0 BAT_TABLE -set PERIOD_INDICES { 0 } NO_BAT_ENTRIES 1 NO_BAT_PERIODS 1 NO_REPEAT_ENTRY 1 NO_REPEAT_TABLE 1 NO_EXECUTE_TABLE 1 histmem loadconf # BAT_TABLE -clear histset_XY } Publish histmem_period_single User proc histmem_period_sequence {Np Nt} { histmem stop hmm astop global n_periods set n_periods $Np #FAT_TABLE -set NOS_PERIODS $Np #BAT_TABLE -set PERIOD_INDICES { 0 1} NO_BAT_ENTRIES $Np NO_BAT_PERIODS $Np NO_REPEAT_ENTRY 1 NO_REPEAT_TABLE 1 NO_EXECUTE_TABLE 1 OAT_TABLE -set T {0 $Nt} NTC $Np FAT_TABLE -set FRAME_BUFFER DISABLE histmem clockscale 1000000 histmem loadconf # newfile HISTOGRAM_XYT } Publish histmem_period_sequence User proc histmem_period_sequence_off {} { histmem stop hmm astop global n_periods set n_periods $Np FAT_TABLE -set NOS_PERIODS 1 BAT_TABLE -set PERIOD_INDICES { 0 } NO_BAT_ENTRIES 1 NO_BAT_PERIODS 1 NO_REPEAT_ENTRY 0 NO_REPEAT_TABLE 0 NO_EXECUTE_TABLE 0 histmem loadconf histset_XYperiod } Publish histmem_period_sequence_off User proc histmem_save_period_sequence { } { global n_periods open_hist_file for { set i 0 } { $i < $n_periods } { incr i } { # hmm configure read_data_period_number $i save $i } } Publish histmem_save_period_sequence User proc histmem_period_strobo {Freq Bins} { histmem stop hmm astop global nos_bins set nos_bins $Bins set bintime [expr int(1000000./($Freq*$Bins))] histmem fsrce EXTERNAL set oatstr "OAT_TABLE -set T {0 $bintime} NTC $Bins" # OAT_TABLE -set T { 0 $bintime } NTC $Bins eval $oatstr histmem loadconf histset_XYT } Publish histmem_period_strobo User proc histmem_strobo_off {} { hmm astop histmem fsrce INTERNAL OAT_TABLE -set T { 0 200000 } NTC 1 histmem loadconf histset_XY } Publish histmem_strobo_off User # SetHistoSync: sets the histogram to receive $framenum worth of frames on receiving # TTL pulse in frame sync input. Note: Framebuffer should be set to OFF for long runs proc SetHistoSync {framenum} { histmem stop hmm astop bat_table -set NO_BAT_ENTRIES $framenum NO_BAT_PERIODS $framenum bat_table -set NO_REPEAT_ENTRY 1 NO_REPEAT_TABLE 1 NO_EXECUTE_TABLE 1 PERIOD_INDICES { 0 1 } fat_table -set NOS_PERIODS $framenum oat_table -set T {0 2200000} NTC 1 histmem loadconf histmem fsrce EXTERNAL } publish SetHistoSync user # SetHistoNormal: resets the histo for standard operation proc SetHistoNormal {} { histmem stop hmm astop bat_table -set NO_BAT_ENTRIES 1 NO_BAT_PERIODS 1 bat_table -set NO_REPEAT_ENTRY 0 NO_REPEAT_TABLE 0 NO_EXECUTE_TABLE 0 PERIOD_INDICES { 0} fat_table -set NOS_PERIODS 1 oat_table -set T {0 2200000} NTC 1 oat_table -set Y {-0.5 3.5} NYC 128 histmem loadconf histmem fsrce INTERNAL proc ::histogram_memory::pre_count {} {} } publish SetHistoNormal user proc SetHistoOneShot {frq framenum } { histmem stop hmm astop bat_table -set NO_BAT_ENTRIES $framenum NO_BAT_PERIODS $framenum bat_table -set NO_REPEAT_ENTRY 1 NO_REPEAT_TABLE 1 NO_EXECUTE_TABLE 1 PERIOD_INDICES { 0 1 } fat_table -set NOS_PERIODS $framenum oat_table -set T {0 2200000} NTC 1 oat_table -set Y {-0.5 31.5} NYC 16 histmem freq $frq histmem loadconf histmem fsrce INTERNAL histmem mode unlimited } publish SetHistoOneShot user proc SetHistoStd {} { histmem stop hmm astop FAT_TABLE -set MULTI_HOST_HISTO_STITCH_OVERLAP 8 MULTI_HOST_HISTO_JOIN_STITCH_ORDER INVERTED OAT_TABLE -set X { 991.5 987.5 } NXC 248 Y { -0.5 3.5 } NYC 128 T { 0 20000 } NTC 1 histmem loadconf } publish SetHistoStd user proc SetHistoDX {} { histmem stop hmm astop FAT_TABLE -set MULTI_HOST_HISTO_STITCH_OVERLAP 16 MULTI_HOST_HISTO_JOIN_STITCH_ORDER INVERTED OAT_TABLE -set X { 991.5 989.5 } NXC 496 Y { -0.5 3.5 } NYC 128 T { 0 20000 } NTC 1 histmem loadconf } publish SetHistoDX user