Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Account setup:
    • Your afs unix account must be added to the FACET group.  Contact Ken Brobeck (x2558).
    • You will be logging into the FACET network as the shared fphysics account. For personal matlab settings, Mike Zelazny (x3673) will set you up with an optional user-specific directory and environment under fphysics .
  • Login:
    • Bring up a linux terminal window:
      • from an MCC OPI or linux box click the terminal icon on the desktop
      • from Windows use Secure CRT or XWin-32
    • Log into mcclogin with your afs account:
      ssh mcclogin
    • From mcclogin, log into facet-srv01 as the fphysics account
      ssh fphysics@facet-srv01
    • Enter the number corresponding to your username from the list. If you are not in the username list yet and would like be, then:
      • enter 0 (for None). You will end up in directory /home/fphysics.
      • mkdir username (username is your Unix login username)
      • logout (log out to reset the list)
      • Log back in:
        ssh fphysics@facet-srv01
      • Enter the number corresponding to your username
    • You should now be in /home/fphysics/username (e.g. /home/fphysics/fred)
    • Your environment should now be set up to run and develop matlab scripts.

...

An example: displaying a Design TWISS plot from the SCP:

#top

...

Anchor
matlab
matlab

IV. Matlab

For a complete overview, detailed instructions on developing matlab scripts, and examples, please see the "MATLAB Programmer's Guide for FACET physicists", attached to this Confluence page.

Environment setup THIS ENVIRONMENT SETUP IS OBSOLETE AND WILL BE UPDATED ON 4/25:

  • After you log onto a Linux machine using the fphysics account,

...

  • your environment will be set up for running and developing matlab scripts.
  • source /usr/local/facet/tools/script/ENVS_facet.bash
  • export EPICS_CA_MAX_ARRAY_BYTES=40000000 (if you'll be using OTR image data)
  • export DISPLAY=your_IP_address:0 (if you're logging in from Windows - your_IP_address can be found after running ipconfig)
  • to use CVS, set your own CVSROOT environment variable:
    export CVSROOT=:ext:fred@mcclogin:/afs/slac/g/lcls/cvs (where fred is your username)

Starting matlab

  • type
    matlab

...

  • if you haven't already, cvs checkout the matlab toolbox directory into your working area (/home/fphysics/fred)
    cd /home/fphysics/fred (if you're fred!)
    cvs co matlab/toolbox
  • cd into the toolbox directory
    cd matlab/toolbox
  • to get the latest CVS-ed copy of a script, use cvs update:
    cvs update myScript.m
    or to get the latest CVS-ed copies of all the scripts:
    cvs update
  • work on a new script, or an existing script
  • test thoroughly until your work is ready for primetime
  • cvs add any new scripts you've created
    cvs add myScript.m
  • cvs commit scripts that you have added or changed
    cvs commit myScript.m
  • release new/changed scripts to the production directory (/usr/local/facet/tools/matlab/toolbox)
    cvs2prod myScript.m

Development environment note
Once you have done cvs checkout matlab/toolbox, the next time you login to facet-srv01 (as fphysics - see above Login section) your matlab working directory /home/fphysics/yourusername/matlab/toolbox will be prepended to the MATLABPATH environment variable. This means that when you run a script you're developing, your version will run (instead of/taking precedence over the one in production)

getSystem() function
Within a matlab script you can use the getSystem function to determine the accelerator system defined in the current working environment. This is useful for writing scripts that can be used for multiple accelerator systems, with conditional actions depending on accelerator.

...

Q: How do I release to production?
A: To make software available for general use:use, you will use the cvs2prod utility. See above #matlab "basic flow" section abovve
cvs2prod

Q: How do I get files from /afs to the channel access network?
A: To get a file from /afs that's not in cvs:
scp loos@mcclogin:~loos/controls/profmon/profmon_setup.m

...