# Macros to operate the mar345 Image Plate Scanner # # hp_mar.mac # # hp 19.05.2001 # hp 27.11.2001 # # # # This file redefines the normally empty user macros for scans and counting # requires hp_fio.mac to be loaded before this file is loaded # # # # global definitions # global MAR_ON, MAR_command, MAR_directory, MAR_root, MAR_mode, MAR_format, \ MAR_scp, MAR_scannumber, MAR_mode_description, MAR_mode_nr, \ MAR_format_description, MAR_format_nr, MAR_execute, MAR_execute_command, \ Mar_execute_nr, MAR_execute_description,MAR_wait_for_imageplate # # default values for global variables # MAR_ON = 0 MAR_scannumber = 0 MAR_execute = 0 MAR_command = "SCAN" MAR_directory = "/home/mar345/" MAR_root = "test_" MAR_mode = 3 MAR_format = 1 MAR_scp = "scp mar.com mar345@mar.mu.aps.anl.gov:log/mar.com > /dev/null" MAR_wait_for_imageplate = "ssh mar345@mar.mu.aps.anl.gov %ctest -f log/mar.message && until cat log/mar.message |grep %s |grep ENDED; do sleep 1; done%c" # MAR_mode_nr = 7 MAR_mode_description[0] = "2300 pixels, 345 mm diameters, 0.15 mm pixelsize" MAR_mode_description[1] = "2000 pixels, 300 mm diameters, 0.15 mm pixelsize" MAR_mode_description[2] = "1600 pixels, 240 mm diameters, 0.15 mm pixelsize" MAR_mode_description[3] = "1200 pixels, 180 mm diameters, 0.15 mm pixelsize" MAR_mode_description[4] = "3450 pixels, 345 mm diameters, 0.10 mm pixelsize" MAR_mode_description[5] = "3000 pixels, 300 mm diameters, 0.10 mm pixelsize" MAR_mode_description[6] = "2400 pixels, 240 mm diameters, 0.10 mm pixelsize" MAR_mode_description[7] = "1800 pixels, 180 mm diameters, 0.10 mm pixelsize" # MAR_format_nr = 2 MAR_format_description[0] = "SPIRAL" MAR_format_description[1] = "MAR345" MAR_format_description[2] = "IMAGE" # MAR_execute_nr = 2 MAR_execute_command[0] = "SCAN" MAR_execute_command[1] = "ERASE" MAR_execute_command[2] = "CHANGE" MAR_execute_description[0] = "read out the data, store it to disk and erase image plate" MAR_execute_description[1] = "ERASE the image plate" MAR_execute_description[2] = "CHANGE the mode of the image plate" # # # # ################################################################################# # # mar_show_settings # # hp 27.11.2001 # # shows present configuration of Mar 345 Image Plate Scanner # ################################################################################ # def mar_show_settings ' { printf("\nmar_show_settings (hp) 27.11.2001\n\n") _mar_show_settings } ' # # # # ################################################################################# # # _mar_show_settings # # hp 27.11.2001 # # shows present configuration of Mar 345 Image Plate Scanner # ################################################################################ # def _mar_show_settings ' { printf("Data directory: %s\n",MAR_directory) printf("Next scan name: %s%u\n",MAR_root,MAR_scannumber) printf("Data type: %s\n",MAR_format_description[MAR_format]) printf("Mode: %s\n",MAR_mode_description[MAR_mode]) } ' # # # # ################################################################################# # # mar_setup # # hp 27.11.2001 # # configures all necessary variables for the mar345 image plate # ################################################################################ # def mar_setup ' { local i printf("\n Configuration of MAR345 Image Plate Scanner (hp) 27.11.2001\n") MAR_directory = getval("Directory for data files",MAR_directory) MAR_root = getval("General scan name",MAR_root) MAR_scannumber = getval("Actual scan number",MAR_scannumber) printf("Operation mode:\n") for(i=0;i<=MAR_mode_nr;i++) { printf(" (%u) - %s\n",i,MAR_mode_description[i]) } MAR_mode = getval("Chose operation mode",MAR_mode) printf("Data Format (MAR345 strongly recommended!):\n") for(i=0;i<=MAR_format_nr;i++) { printf(" (%u) - %s\n",i,MAR_format_description[i]) } MAR_format = getval("Chose data format",MAR_format) printf("\nNew setup for MAR345 Image Plate Scanner:\n\n") _mar_show_settings } ' # # # # ################################################################################# # # mar_execute # # hp 27.11.2001 # # executes a command on the MAR345 Image Plate Scanner # ################################################################################ # def mar_execute ' { local _1,i if ($# == 1) { _1 = $1 } else if ($# == 0) { printf("\n") for(i=0;i<=MAR_execute_nr;i++) { printf("(%u) %s - %s\n",i,MAR_execute_command[i],MAR_execute_description[i]) } _1 = getval("Your choice",MAR_execute) } else { eprint("usage: mar_execute [command]") exit } if ((_1>=0) && (_1<=MAR_execute_nr)) { MAR_execute = _1 MAR_command = MAR_execute_command[MAR_execute] } else { eprint("mar_execute: Error non executable command issued.") exit } if (MAR_execute == 0) { MAR_scannumber +=1 printf("\nStarted reading MAR image plate scan No. %u at %s\n",MAR_scannumber,date()) } _mar_create_commandfile _mar_copy_commandfile } ' # # # # ################################################################################# # # mar_read # # hp 27.11.2001 # # reads a image from the mar345 image plate and stores it do disk # ################################################################################ # def mar_read ' { mar_execute 0 mar_wait_for_imageplate } ' # # # # ################################################################################# # # mar_wait_for_imageplate # # hp 27.11.2001 # # waites for the mar345 detector to be finished with executing the last command # ################################################################################ # def mar_wait_for_imageplate ' { local unix_command unix_command = sprintf(MAR_wait_for_imageplate,34,MAR_command,34) unix(unix_command) } ' # # # # ################################################################################# # # _mar_create_commandfile # # hp 27.11.2001 # # creates the file mar.com from which scan345 reads its commands # ################################################################################ # def _mar_create_commandfile ' { local filename,unix_command_1 filename = "mar.com" unix_command_1 = sprintf("rm -f %s",filename) unix(unix_command_1) open(filename) fprintf(filename,"COMMAND %s\n",MAR_command) fprintf(filename,"DIRECTORY %s\n",MAR_directory) if (MAR_scannumber < 10) { fprintf(filename,"ROOT %s00%u\n",MAR_root,MAR_scannumber) } else if ((MAR_scannumber >= 10) && (MAR_scannumber < 100)) { fprintf(filename,"ROOT %s0%u\n",MAR_root,MAR_scannumber) } else { fprintf(filename,"ROOT %s%u\n",MAR_root,MAR_scannumber) } fprintf(filename,"MODE %u\n",MAR_mode) fprintf(filename,"FORMAT %s\n",MAR_format_description[MAR_format]) close(filename) } ' # # # # ################################################################################# # # _mar_copy_commandfile # # hp 27.11.2001 # # copies the command file mar.com to the MAR345 image plate control computer # ################################################################################ # def _mar_copy_commandfile ' { unix(MAR_scp) } ' # # # # ################################################################################# # # user_precount # # hp 19.05.2001 # # executed before counting is done (normally defined empty in standart.mac) # ################################################################################ # def user_precount ' { if (MAR_ON > 0) { COUNT_TIME += 2 } } ' # # # # ################################################################################# # # user_postcount # # hp 19.05.2001 # # executed after counting is done (in ct) (normally defined empty in standart.mac) # ################################################################################ # def user_postcount ' { if (MAR_ON > 0) { local hpctime hpctime = COUNT_TIME -2 sleep(0.5) marshutter open sleep(hpctime) marshutter close sleep(0.5) } } ' # # # #