From: Michael Wiebusch Date: Wed, 9 Dec 2015 12:51:29 +0000 (+0100) Subject: removed unused junk from git X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=ca1da843c35221a1be20d2097bfa54e1070fdb7e;p=coral.git removed unused junk from git --- diff --git a/user_interface/analyzer.pl b/user_interface/analyzer.pl deleted file mode 100755 index 3e0c71e..0000000 --- a/user_interface/analyzer.pl +++ /dev/null @@ -1,202 +0,0 @@ -#!/usr/bin/perl -use strict; -use warnings; -use Device::SerialPort; -use Time::HiRes; -use Getopt::Long; -use POSIX qw/strftime/; -use POSIX; - -# plot destination -# check for tools - - - - -# defaults -my $baudrate=115200; -my $port; -my $opt_command; -my $read; -my $opt_help; -my $write; -my $clear; -my $clkdiv; -my $window; - - -my $ser_dev = "/dev/ttyUSB0"; - - - -GetOptions ( 'h|help' => \$opt_help, - 'c|cmd=s' => \$opt_command, - 'tty=s' => \$ser_dev, - 'baud=s' => \$baudrate, - 'r|read=s' => \$read, - 'w|write=s' => \$write, - 'c|clear' => \$clear, - 'd|divider=s' => \$clkdiv, - 'window=s' => \$window - ); - - -init_port(); - - -if (defined ($read)) { - - my $val = communicate("R".chr($read)); - printf("response: %d\n",$val); - - exit; -} - -if (defined($clear)){ - $write = '129_1'; -} - - -if (defined($window)){ - my $tunit=1e-3; - if($window =~ m/ms/){ - $tunit=1e-3; - } elsif($window =~ m/us/){ - $tunit=1e-6; - } elsif($window =~ m/ns/){ - $tunit=1e-9; - } elsif($window =~ m/s/){ - $tunit=1; - } - - $window =~ m/([\d\.]+)/; - my $number = $1; - printf("requested window width: %e s\n",$number*$tunit); - my $FPGAclk=133000000; - my $analyzerBins=128; - $clkdiv = floor(($number*$tunit)/$analyzerBins/(1/$FPGAclk)); - -} - -if (defined($clkdiv)){ - $write = "128_$clkdiv"; -} - -if (defined ($write)) { - - unless( $write =~ m/(\d+)_(\d+)/ ) { - die "input parameter: analyzer -w 127_1234\n"; - } - - my $addr = $1; - my $value = $2; - print "addr:$addr value:$value\n"; - - my $byte3 = chr(int($value)>>24); - my $byte2 = chr((int($value)>>16)&0xFF); - my $byte1 = chr((int($value)>>8)&0xFF); - my $byte0 = chr(int($value)&0xFF); - - my $val = communicate("W".chr($addr).$byte3.$byte2.$byte1.$byte0); - printf("response: %d\n",$val); - - exit; -} - - -for (my $i=0;$i<128;$i++){ - my $val = communicate("R".chr($i)); -# printf ("length of response: %d \n",length($rstring)); - printf("%d\t%d\n",$i,$val); -# printf("addr %d:\t%d.%d.%d.%d\n",$i,$byte3,$byte2,$byte1,$byte0); -# Time::HiRes::sleep(.01); -} - - - - -sub communicate { - - my $ack_timeout=0.5; - - my $command = $_[0]; -# print "sending command $command\n"; - my $rstring; - - - $port->are_match(""); - $port->read_char_time(1); - $port->read_const_time(0); - $port->lookclear; - #Time::HiRes::sleep(.004); - $port->write("$command\n"); - - my $ack = 0; - - - - #Time::HiRes::sleep(.004); - - my ($count, $a) = $port->read(12); - - if($a=~ m/R(.{4})/s) { - $rstring= $1; -# print "padiwa sent: $cmd_echo\n\n"; - $ack=1; - } - - - - unless($ack) { - print "no answer\n"; - return 0; - } - my $byte3 = ord(substr($rstring,0,1)); - my $byte2 = ord(substr($rstring,1,1)); - my $byte1 = ord(substr($rstring,2,1)); - my $byte0 = ord(substr($rstring,3,1)); - my $val = (($byte3<<24)|($byte2<<16)|($byte1<<8)|$byte0); - - return $val; - - - -} - - - - - - -sub init_port { - - - # talk to the serial interface - - $port = new Device::SerialPort($ser_dev); - unless ($port) - { - print "can't open serial interface $ser_dev\n"; - exit; - } - - $port->user_msg('ON'); - $port->baudrate($baudrate); - $port->parity("none"); - $port->databits(8); - $port->stopbits(1); - $port->handshake("none"); - $port->write_settings; - -} - - - -sub getValue { - my $valName=$_[0]; - my $answer = communicate($valName); - if($answer =~ m/$valName=([^=]+)/){ - return $1; - } - die "could not retrieve desired value $valName!"; -} diff --git a/user_interface/clear.png b/user_interface/clear.png deleted file mode 100644 index cffb1c1..0000000 Binary files a/user_interface/clear.png and /dev/null differ diff --git a/user_interface/deadtime_analysis.sh b/user_interface/deadtime_analysis.sh deleted file mode 100755 index 6ff3e0b..0000000 --- a/user_interface/deadtime_analysis.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -file=deadtime_analysis.dat - ->$file - -echo -e "#deadtime in us\t#counts" - -for t in $(seq 0 1 40) -do -./pmt_ro.pl sub=dead_time value=$t unit=us -counts=$(./pmt_ro.pl sub=count channel=signal delay=5) - -echo -e "$t\t$counts" -echo -e "$t\t$counts" >> $file -done diff --git a/user_interface/gui.pl b/user_interface/gui.pl deleted file mode 100755 index 5e0e1e4..0000000 --- a/user_interface/gui.pl +++ /dev/null @@ -1,170 +0,0 @@ -#!/usr/bin/perl -w - -use strict; -use Gtk2 '-init'; - -use constant TRUE => 1; -use constant FALSE => 0; - -my $save_dir = "./saved"; - -my $window = Gtk2::Window->new; -$window->set_title ('FPGA based pulse width analyzer'); -$window->signal_connect (destroy => sub { Gtk2->main_quit; }); -$window->set_border_width(3); - -my $vbox = Gtk2::VBox->new(FALSE, 6); -$window->add($vbox); - -my $actions_frame = Gtk2::Frame->new('Actions'); -$vbox->pack_start($actions_frame, TRUE, TRUE, 0); -$actions_frame->set_border_width(3); - - -my $save_frame = Gtk2::Frame->new('Save'); -$vbox->pack_start($save_frame, TRUE, TRUE, 0); -$actions_frame->set_border_width(3); - -my $save_frame_hbox = Gtk2::HBox->new(FALSE, 6); -$save_frame->add($save_frame_hbox); -$save_frame_hbox->set_border_width(3); - - -my $plot_frame = Gtk2::Frame->new('Plot'); -$vbox->pack_start($plot_frame, TRUE, TRUE, 0); -$plot_frame->set_border_width(3); - - -my $hbox = Gtk2::HBox->new(FALSE, 6); -$actions_frame->add($hbox); -$hbox->set_border_width(3); - - - -################################################## -## buttons ## -################################################## - -my $inc_button = Gtk2::Button->new('_Click Me'); -# $hbox->pack_start($inc_button, FALSE, FALSE, 0); -my $count = 1; - -my $plot_button = Gtk2::Button->new('_Plot'); -$hbox->pack_start($plot_button, FALSE, FALSE, 0); - -my $clear_button = Gtk2::Button->new('_Clear'); -$hbox->pack_start($clear_button, FALSE, FALSE, 0); - -my $windowLength_entry = Gtk2::Entry->new; -$windowLength_entry->set_text('100us'); -$hbox->pack_start($windowLength_entry, FALSE, FALSE, 0); - - - - -my $setWindowLength_button = Gtk2::Button->new('_Set window length'); -$hbox->pack_start($setWindowLength_button, FALSE, FALSE, 0); - - - -my $quit_button = Gtk2::Button->new('_Quit'); -# $hbox->pack_start($quit_button, FALSE, FALSE, 0); -$quit_button->signal_connect( clicked => sub { - Gtk2->main_quit; - }); - - - - -my $filename_entry = Gtk2::Entry->new; -$filename_entry->set_text('last_aquisition'); -$save_frame_hbox->pack_start($filename_entry, FALSE, FALSE, 0); - -my $save_button = Gtk2::Button->new('_Save data and plot'); -$save_frame_hbox->pack_start($save_button, FALSE, FALSE, 0); - - - -my $image = Gtk2::Image->new_from_file ("clear.png"); -# $vbox->pack_start($image, TRUE, TRUE, 0); -$plot_frame->add($image); - - - - -my $label = Gtk2::Label->new('... debug out'); -$vbox->pack_start($label, TRUE, TRUE, 0); - - - -################################################## -## button functions ## -################################################## -# has to be done after we've created the label so we can get to it -$inc_button->signal_connect( clicked => \&update_clicks); -sub update_clicks { - -# $label->set_text("Clicked $count times."); - $count++; - -} - - -$plot_button->signal_connect( clicked => sub { - -# $label->set_text(qx%echo blah%); - execute("./plot.sh"); - show_image("plot.png"); - -}); - -$clear_button->signal_connect( clicked => sub { - - execute("./analyzer.pl --clear"); - show_image("clear.png"); - -}); - -$save_button->signal_connect( clicked => sub { - my $filename = $filename_entry->get_text(); - unless( -e $save_dir ) { - execute("mkdir -p $save_dir") - } - execute("cp out.dat $save_dir/$filename.dat"); - execute("cp plot.png $save_dir/$filename.png"); - -}); - -$setWindowLength_button->signal_connect( clicked => sub { - my $windowLength = $windowLength_entry->get_text(); - execute("./analyzer.pl --window $windowLength"); -# $label->set_text($windowLength_entry->get_text()); - execute("./analyzer.pl --clear"); - show_image("clear.png"); - -}); - - -sub execute { - my $command = shift; - print "execute:\n$command\n"; - system($command); - print "\n\n"; - -} - -sub show_image{ - my $filename = shift; - $plot_frame->remove($image); - $image->clear; - $image = Gtk2::Image->new_from_file($filename); - $plot_frame->add($image); - $window->show_all; -} - - - - - -$window->show_all; -Gtk2->main; \ No newline at end of file diff --git a/user_interface/plot.png b/user_interface/plot.png deleted file mode 100644 index 8f57cba..0000000 Binary files a/user_interface/plot.png and /dev/null differ diff --git a/user_interface/plot.sh b/user_interface/plot.sh deleted file mode 100755 index 772bac3..0000000 --- a/user_interface/plot.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -left=$1 -right=$2 - -./analyzer.pl > out.dat -cat < 1; -use constant FALSE => 0; - -my $window = Gtk2::Window->new; -$window->set_title ('Widget Layout'); -$window->signal_connect (destroy => sub { Gtk2->main_quit; }); -$window->set_border_width(3); - -my $vbox = Gtk2::VBox->new(FALSE, 6); -$window->add($vbox); - -my $frame = Gtk2::Frame->new('Buttons'); -$vbox->pack_start($frame, TRUE, TRUE, 0); -$frame->set_border_width(3); - -my $hbox = Gtk2::HBox->new(FALSE, 6); -$frame->add($hbox); -$hbox->set_border_width(3); - -my $inc_button = Gtk2::Button->new('_Click Me'); -$hbox->pack_start($inc_button, FALSE, FALSE, 0); -my $count = 1; - -my $quit_button = Gtk2::Button->new('_Quit'); -$hbox->pack_start($quit_button, FALSE, FALSE, 0); -$quit_button->signal_connect( clicked => sub { - Gtk2->main_quit; - }); - -my $label = Gtk2::Label->new('Clicked 0 times.'); -$vbox->pack_start($label, TRUE, TRUE, 0); - -# has to be done after we've created the label so we can get to it -$inc_button->signal_connect( clicked => sub { - $label->set_text("Clicked $count times."); - $count++; - }); - -$window->show_all; -Gtk2->main;