esrf

Beamline Instrument Software Support
SPEC Macro documentation: [ Macro Index | BCU Home ]

ccd.mac
See other macros in category: Detection Ccd
Description:
    General macros for all CCD cameras
Documentation:
    DESCRIPTION
    Gives the user macros to work with the CCD cameras. The main problem are the different features of different cameras.
    Taking images
    ccdtake
    Takes one image. Does not save the image.
    ccdtakeall
    All ccds configured take one image.
    ccdlive
    Takes images continiously until ^c is pressed.
    ccdsum
    Takes a number of images and sums them up.
    Saving images to disk
    This can also be configured from ccdmenu
    ccdnewfile
    Defines prefix, suffix and run number for the files.
    ccdsave
    Saves the image taken with ccdtake.
    Setting up parameters
    CCD cameras must be configured either by ccdmenu (interactive and for all ccd devices) or by ccdsetup (can be called with arguments and once per ccd device.
    ccdmenu
    Configures the general parameters of all CCD devices.
    ccdsetup
    Configures the general parameters of a particular CCD.
    ccdroi
    Defines a region of interest
    ccdbin
    Defines a row and column binning for the camera Use ccdmenu instead
    ccdinfo
    Shows current ccd configuration
    Scanning
    ccdon
    Instructs spec to take imaged at every scan point
    ccdoff
    Spec will not take images at every scan point anymore
    Special Documentation for Spec internal functions
    image_par(device,"halt")
    image_par(device,"run")
    Prepares the camera to run. Will start exposure depending on preset and programmed modes. 1.) Preset 0 : (Cmd : image_par(0,"preset",0) ) The camera will be started to expose until stopped by a TTL signal (Princeton & Frelon) on EXT_TRIG input. 2.) If we have a preset time (Cmd : image_par(0,"preset",1.4)) a.) Not in external trigger mode (Cmd : image_par(0,"ext_trig",0)) The camera will expose the preset time. b.) We are in external trigger mode (Cmd : image_par(0,"ext_trig",1)) i.) We are not in preopen mode (Cmd : image_par(0,"pre_open",0)) The camera will wait for the external trigger. It will open the shutter and start exposing for the preset time when the TTL trigger signal is activated. ii.) We are in preopen mode (Cmd : image_par(0,"pre_open",1)) The camera will open the shutter. It will continue to clear the ccd chip until the external trigger comes. At that point it will expose for the preset time and close the shutter.
    wait (0x4)
    Will wait until all acquire devices are finished. For our cameras this function will wait until the image is in the computer memory.
    wait (0x24)
    Returns true if the device is still acquiring. For the cameras that means that the image is not yet in memory.
    image_get (device, ARRAY)
    Will put the image in the spec array ARRAY. Will not start any acquisition but waits until the image is in memory.
    image_par(device,parameter)
    "row_beg" "row_end" "col_beg" "col_end"
    Program reagion of interest on the ccd chip
    "row_bin" "col_bin"
    Binning factor on the ccd chip. A binning factor must be an integer value. It represents the number of pixels which are read out together.
    "rows" "cols"
    Rows and cols of the ccd chip taking into account the binning. (i.e. 1024 x 1024 with a binning factor of 2 2 will report 512 rows and 512 cols)
    "ext_trig" "pre_open"
    Determ. the function of the external TRIG TTL input. See image_par(device,"run") above.
    "auto_run" "soft_preset" "add_time"
    Flags which influence the way the camera reacts when the user types ct. If auto_run is true then the camera is programmed to start before SPECs timer is started. The gate output from the timer might be used to gate the camera when this is possible in hardware. Princeton : For the moment I did not find a way to do that. Therefore the shutter is programmed to open (preopen) and the clearing to be stopped when the software gives the "run" command. Some ms before the timer is started. On the falling edge of the signal, a very sort image is taken. This should ressemble very much a start / stop mode where the start signal is given by software but the stop signal by hardware. As long as the shutter is gated by SPEC's timer, this should not be much of a problem.
    soft_preset :
    This flag can be used to program the camera to expose the same time as the SPEC timer. The camera is started slightly earlier and stops slightly earlier as both time bases (SPEC and the camera) are set to the same value.
    add_time :
    When the shutter is controlled by the SPEC timer it can be useful to add a certain time to compensate for the early opening of the camera. In this way the camera will expose all the time while the shutter (controlled by SPEC's timer) is open. The value to be given is in seconds.
    "preset"
    The time in seconds the camera will acquire. A zero value means forever.
    "ext_shutter"
    Flag only for princeton. If true, the optical shutter of the camera is controlled by an external TTL input on the controller.
    "slow_adc"
    Flag only for princeton. The slower adc is used if there is a choice of two adc. If there is only one adc installed in the controller, this flag has no effect.
    "clean_scans"
    Do not know so precisely yet. Might not be the number of full clean scans because it is put to a very high number in the PI code. There to be tried.
    Configuring the camera in spec:
    You have to add the following line in SPECs configuration screen:
    CCD-like       DEVICE   ADDR  <>MODE                         <>TYPE
    0    YES    /dev/sdv0      1                Princeton CCD Interface
    
    addr == 1                       EEV_1152x1242_3ph
    addr == 2                   TEK_1024x1024_B_100ns
    
    
    History DFC 2001/10/24: ccdintegr fixed (now we can always take it off, even if the counter was not defined)

    EXAMPLE


    SETUP
    The ccd camera must be configured with specs configuration editor. The macro ccdsetup must run at least once. It is therefore suggested to put it into your startup file (idxxsetup.mac).

Macros:
    ccdinfo
    Usage: ccdinfo
    Show current setup for a given camera.

    _ccdmenu
    Usage: _ccdmenu
    Interactive macro to configure all ccd devices.

    andortemp
    Usage: andortemp [<setpoint>]
    Without argument, read cooler status, actual and setpoint temperature
    With <setpoint> argument, set the input setpoint and wait that temperature has stabilized at this set point value.

    pcotemp
    Usage: pcotemp [<setpoint>]
    Without argument, read actual and setpoint temperature
    With <setpoint> argument, set the input setpoint and wait that temperature has reached set point value.

    ccdsetup
    Usage: ccdsetup [ soft_preset add_time save_after_ct ]
    Set up macros to work with a given camera.

    ccdresetupall
    Usage: ccdresetupall
    call ccdresetup for all the configured cameras

    ccdresetup
    Usage: ccdresetup [ccd-unit]
    Reapply the current setup, ccdbin, ccdroi, soft_preset, ext_trig and preset Has to bep put in your spec setup to recover the camera setup after a reconfig ( or a camera reset).

    ccdnewfile
    Usage: ccdnewfile
    Sets a new file prefix and initialises the run number. The file name will be: DIRPREFIXnnnnSUFFIX. It is possible to change this default file name with special keywords. See internal macro ccdfilename for more information how to do that. Decides if images are saved after counting (see ccdsave_)

    ccdsave
    Usage: ccdsave
    Saves the global image array image_data? (ACTIVE) to the file defined by ccdnewfile.

    ccd_add_header_param
    Usage: ccd_add_header_param (<param name>, <param value>, [<param description>])
    Adds a parameter and the corresponding value in CCD_SUP_HEADER stlist. CCD_SUP_HEADER is used to build a CCD header of edf file. A description of the parameter can be added. *examples : ccd_add_header_param("couleur", "rouge", "couleur du detecteur.") ccd_add_header_param("age", "2", "age du detecteur (in years).")

    ccd_show_sup_header
    Usage: ccd_show_sup_header [desc]
    Displays, in a readable manner, the CCD_SUP_HEADER list. example : > ccd_show_sup_header 1 /-- CCD supplementary header informations (CCD_SUP_HEADER stlist) --\ * couleur = rouge desc : couleur du detecteur. * age = 2 desc : age du detecteur (in years). \-------------------------------------------------------------------/

    ccdtake
    Usage: ccdtake
    Takes one image with the camera. The result is not automatically saved to disk.

    ccdstart
    Usage: ccdstart [<exposure_time> [<no_images>]]
    Starts the active (default) camera. Sets "preset" and "images" parameters : exposure time and number of images.

    ccdread
    Usage: ccdread [<ccd_unit>]
    reads an image into spec shared memory. If no argument uses the default camera

    ccdgui
    Usage: ccdgui
    Setup the display GUI

    ccdon
    Usage: ccdon
    The camera will be started automatically at every scan point.

    ccdoff
    Usage: ccdoff
    The camera will not longer be started at every scan point.

    ccdfilm
    Usage: ccdfilm
    Goes through buffer of multi-image and wait between each image

    ccdlive
    Usage: ccdlive
    Takes images continiously and displays some statistical data You can finish image taking by typing "~". (^c also ends image taking but aborts the current image).

    ccdroi
    Usage: ccdroi [use_roi xmin xmax ymin ymax]
    Defines a new region of interest for the camera.

    ccdintegr
    Usage: ccdintegr [CCD_no 1=integrate/0=no 0=integration/1=avg/2=std mne1 mne2 1=cntRoI/0=noRoI <roistr>]
    Defines counter options for statistics on the camera

    ccdbin
    Usage: ccdbin [x-bin y-bin]
    Sets a binning ratio for the camera. The binning is done in hardware on the camera. Not all cameras provide this feature.

    ccdsum
    Usage: ccdsum <exp_time> <no of cycles>
    Macro takes <no of cycles> images and adds them up in another array. The sum array is shared and can therefore be watched life with the online display. The shared array is of type unsigned long (Max number of counts per pixel : 2^32). The sum array is saved to disk after the measurement.

    ccd_open_file
    Usage: ccd_open_file <file_name>
    Reads an image file into image_data* array (ushort)

    ccderase
    Usage: ccderase [ccd device number] %MDESC Start erasure of the image plate
    MAR SCANNER only.


    ccdmode
    Usage: ccdmode [image mode] [ccd device number] %MDESC change image SIZE mode possible values are:
    [1800,1200,2400,1600,3000,2000,3450,2300]
    MAR SCANNER only.


    ccdviewfactor
    Usage: ccdviewfactor [view factor] [ccd device number] %MDESC change the view factor (1/xth of image seen)
    MAR Scanner only.


    f3menu
    Usage: f3menu
    Frelon Menu to talk directly to the camera controller. A lot of parameters can be configured this way.

    f3sendfile
    Usage: f3sendfile [filename]
    Sets the camera up using a special configuration file. The file consists of a list of the commands to send. Only for Frelon

    ccdcreateR
    Usage: ccdcreateR
    Creates an image with a big letter R. This can be used to define the camera orientation for other programs to be read in.

Internal Macros:
    _ccd_globals
    Usage: _ccd_globals
    Declaration of all globals used in ccdmenu, ccdsetup and ccdresetupall.

    ccdsetup2
    Usage: ccdsetup2


    ccdmenu
    Usage: ccdmenu


    _ccd_private_menu
    Usage: _ccd_private_menu


    ccd_other_show
    Usage: ccd_other_show


    _ccd_private_show
    Usage: _ccd_private_show


    ccd_other_setup
    Usage: ccd_other_setup


    _guess_camera
    Usage: _guess_camera(ccd_u)


    ccdbpm_private_show
    Usage: ccdbpm_private_show


    ccdbpm_private_setup
    Usage: ccdbpm_private_setup


    _ccd_private_setup
    Usage: _ccd_private_setup


    _ccd_frelon_ds_private_show
    Usage: _ccd_frelon_ds_private_show


    _ccd_prince_private_show
    Usage: _ccd_prince_private_show


    _ccd_sensi_private_show
    Usage: _ccd_sensi_private_show


    _ccd_andor_getparlist
    Usage: _ccd_andor_getparlist(name)


    _ccd_andor_update_pars
    Usage: _ccd_andor_update_pars


    _ccd_andor_private_show
    Usage: _ccd_andor_private_show


    _ccd_andor_private_setup
    Usage: _ccd_andor_private_setup


    _ccd_pco_private_show
    Usage: _ccd_pco_private_show


    _ccd_pco_private_setup
    Usage: _ccd_pco_private_setup


    _ccd_pco_update_pars
    Usage: _ccd_pco_update_pars


    _ccd_remote_headerinfo
    Usage: _ccd_remote_headerinfo()


    _ccd_remote_file_setup
    Usage: _ccd_remote_file_setup


    _ccd_scanner_view_factor
    Usage: _ccd_scanner_view_factor


    _ccd_scanner_erase
    Usage: _ccd_scanner_erase


    _ccd_scanner_format_mode
    Usage: _ccd_scanner_format_mode


    _ccd_scanner_setup
    Usage: _ccd_scanner_setup


    _ccd_send_hw_pars
    Usage: _ccd_send_hw_pars


    _ccd_frelon_ds_private_setup
    Usage: _ccd_frelon_ds_private_setup


    frelonlive
    Usage: frelonlive


    freloncache
    Usage: freloncache


    frelonlivecache
    Usage: frelonlivecache


    ccdcachefilm
    Usage: ccdcachefilm


    ccdstop
    Usage: ccdstop


    __ccd_check_soft_init
    Usage: __ccd_check_soft_init (ccd-unit)
    this macro is only called from ccdresetup and ccdon, it is intended to initialise the trigger mode when spec is starting from fresh and ccdmenu has not been used as a preliminary setup.

    ccd_pisetup
    Usage: ccd_pisetup


    ccd_pisetup_temp
    Usage: ccd_pisetup_temp


    ccd_frelonsetup
    Usage: ccd_frelonsetup


    ccd_photomsetup
    Usage: ccd_photomsetup


    ccd_photonic_setup
    Usage: ccd_photonic_setup


    sensi_setup
    Usage: sensi_setup


    ccd_pc_ccd_setup
    Usage: ccd_pc_ccd_setup


    ccd_frelon_info
    Usage: ccd_frelon_info


    ccd_general_info
    Usage: ccd_general_info


    ccd_prince_info
    Usage: ccd_prince_info


    ccd_photom_info
    Usage: ccd_photom_info


    ccd_photonic_info
    Usage: ccd_photonic_info


    ccd_pc_devinfo
    Usage: ccd_pc_devinfo


    ccdnewfile_function
    Usage: ccdnewfile_function(arg_str)


    _ccd_autosave_mode
    Usage: _ccd_autosave_mode(unit, flag)


    _ccdnewfile
    Usage: _ccdnewfile


    ccdfilename
    Usage: ccdfilename (prefix, number, suffix)
    Returns filename created from prefix number and suffix. The standard format will be <prefix>nnnn<suffix>. This format can be changed by adding keywords to the filename.
    #n[digits]
    This sequence will be replaced by the current scan number. [digits] is optional and specifies the number of digits to put. (example #n4 will be replaced by 0011.)
    #p[digits]
    This sequence will be replaced by the current scan point number.
    #r[digits]
    This sequence will be replaced by the current run number.
    If a keyword is present in either the prefix or the suffix, the filename will be <prefix><suffix> without the run number. (with all occurences of the keywords mention above replaced by the actual values of the run number, scan number or point number ) This macro function uses the global variables: SCAN_N NPTS

    _ccdsave
    Usage: _ccdsave
    Saves the global image array image_data? to the file defined by ccdnewfile. Only if "save after each scan point". change either with "ccdsetup" or "ccdnewfile". Used in ccdon and ccdoff

    ccd_presave
    Usage: ccd_presave


    ccd_postsave
    Usage: ccd_postsave


    __ccdsave
    Usage: __ccdsave
    Used by _ccdsave and ccdsave

    ccd_save
    Usage: ccd_save ( file, image , flag)
    Saves an image array to the file. The information for the header is taken from the current global variables with the function _ccd_headerinfo. If bit 1 of flag is set, there will be no test if the file already exists. The old file will be overwritten.

    _ccd_headerinfo
    Usage: _ccd_headerinfo
    Puts information about the last image taken into the array header. This macro uses the global variables: SCAN_N NPTS COUNT_TIME CCD_OFFSET_SUBS CCD_U CCD_N CCD_DIR CCD_PREFIX MOTORS COUNTERS

    waitacq
    Usage: waitacq


    waitacq2
    Usage: waitacq2


    waitacq_nowait
    Usage: waitacq_nowait


    ccd_prestart
    Usage: ccd_prestart


    ccd_poststart
    Usage: ccd_poststart


    ccdtakeM
    Usage: ccdtakeM


    _ccdtakemenu
    Usage: _ccdtakemenu


    _ccdread
    Usage: _ccdread [<ccd_unit>]
    reads an image into spec shared memory. If no argument uses the default camera.
    Do not read the image if the read-mode is set to "no-read" (1)

    __ccdread
    Usage: __ccdread


    camera_online
    Usage: camera_online
    Starts the online display application for the active camera. Tests first if not already running. OBSOLETE, but kept for backward compatibility with local macros

    ccd_display_start
    Usage: ccd_display_start(__ccd_u)
    Starts the online display application for the active camera. Tests first if not already running.

    ccd_display_stop
    Usage: ccd_display_stop ()
    Stops the online display application.

    ccd_display
    Usage: ccd_display ()
    Starts the online display application (onze) and returns its pid.

    _ccd_version_after_60601
    Usage: _ccd_version_after_60601()


    _ccd_cdef
    Usage: _ccd_cdef()


    _ccd_uncdef
    Usage: _ccd_uncdef()


    _ccd_getcounts
    Usage: _ccd_getcounts()


    _ccd_savecounts
    Usage: _ccd_savecounts()


    _resetfilmframe
    Usage: _resetfilmframe


    ccdintegron
    Usage: ccdintegron


    _ccdintegron
    Usage: _ccdintegron(__ccd_u)


    ccdintegroff
    Usage: ccdintegroff


    _ccdintegroff
    Usage: _ccdintegroff(__ccd_u)


    _ccd_stat_counters
    Usage: _ccd_stat_counters(_ccd_u)


    ccdplot
    Usage: ccdplot


    _ccdplot
    Usage: _ccdplot(what)


    ccd_plotit
    Usage: ccd_plotit()


    ccd_createarray
    Usage: ccd_createarray [<ccd_unit>]
    Defines or redefines the shared array image_data?. If no argument is given, it uses the active CCD unit to create the image_data? name.

    ccd_createarrays
    Usage: ccd_createarrays
    Creates as many image_data arrays as CCD devices configured. image_data1 image_data2 image_data3 .... etc

    ccdtakeall
    Usage: ccdtakeall
    Takes (Starts polls and waits and reads) an image with all ccd configured

    ccddefault
    Usage: ccddefault
    Changes the current CCD device active (by default when using macros for just one ccd (i.e. ccdtake) all ccd configured

    ccdload
    Usage: ccdload


    ccdreadfile
    Usage: ccdreadfile


    ccd_kin_setup
    Usage: ccd_kin_setup


    ccd_kin_show
    Usage: ccd_kin_show


    ccd_kin_on
    Usage: ccd_kin_on


    ccd_kin_off
    Usage: ccd_kin_off


    marscan
    Usage: marscan


    marerase
    Usage: marerase


    marmode
    Usage: marmode


    marviewfactor
    Usage: marviewfactor


    f4send
    Usage: f4send [<command>]
    Sends a command directly to the camera. Only for Frelon

    f5send
    Usage: f5send [<command>]
    Sends a command directly to the camera. Only for Frelon Working on frelon device server

    f3send
    Usage: f3send [<command>]
    Sends a command directly to the camera. Only for Frelon 2k Working on frelon/espia device server

    f3_dump
    Usage: f3_dump
    Reads directly the output from the camera controller and writes it to the screen. Only for Frelon

    _ccd_set_concat
    Usage: _ccd_set_concat(val)


    _ccd_cleanup_concat
    Usage: _ccd_cleanup_concat


    ccds_check_test
    Usage: ccds_check_test


    ccd_is_ok
    Usage: ccd_is_ok(ccd_config_index, verbose)


    ccd_is_ok_and_on
    Usage: ccd_is_ok_and_on(ccd_config_index, verbose)


Filename: ccd.mac
Author: CCD.MAC - BLISS modified 3/9/96 JK, 03/6/01 DFC
Last mod.: 20/03/2023 15:20 by guilloud