Skip to content

Carleton Astronet Admin Log Posts

IDL COLOR PLOTTING WITH FANNING ROUTINES – YUPINGS 2014 UPDATE

On June 11, 2014, Yuping Huang said:

 

I just realized that fsc_color is no longer available because the shared Coyote library was updated a couple weeks ago. So yes the library was updated from its previous early 2000s version. The development for fsc_color stopped at 2011 so now it is not in the library any more, with CGPlot as its successor.

Hence, if you are calling Coyote stuff in idl and found idl telling you that it does not exist, you might want to check the latest Coyote source code online to see if it has been expelled from the library.

Make Evince Display IDL PS Filename on Banner: JUST USE EVINCE!

AS OF 2020 Sep (and I believe much earlier), using the graphics displayer EVINCE automatically puts filename on banner, and furthermore the following did not work with other viewers. Therefore consider the following to be “deprecated” (withdrawn) –jmw

To  actually use evince from the command line, type evince <filename> &

To actually use evince in a nautilus file manager, select (click on) the desired file, and go to
file>>open with>>evince

Commonly when one prints plots to a postscript from IDL and open it with evince(as we always do), the banner of the evince window perennially shows “Graphics Produced By IDL”, which is not helpful at all especially when you’re plotting a thousand plots and trying to compare them.

Hence a pair of IDL routines (OPENPS and CLOSEPS )can be called now to make the output PS file display the file name at the banner and to make the plotting to file process slightly less complicated. The way to call them is as follows:

OPENPS, blablabla.ps      //Before you plot anything. This will set the output device to blablabla.ps and by default color plot

[ DEVICE, FONT_SIZE=9]  //This is the optional part if you want anything about the graph beyond color, see IDL documentation on DEVICE for more

//information. Note that you may overwrite the color attribute here by saying DEVICE,/COLOR=PS

plot,bla

overplot.bla //Plot and add labels and do whatever as you like

CLOSEPS //When you’re done with one graph, simply call CLOSEPS, it will save the file for you and set the plotting device back to xwindows

WARNING: DO CLOSEPS BEFORE YOU OPENPS A NEW FILE. IN OTHER WORDS, EACH PLOT FILE MUST BE ENCLOSED BY A PAIR OF

OPENPS-CLOSEPS statement.

For more information, the code locates at /usr/share/astro/idlshare/locallib, or email huangy@carleton.edu.

 

-yuping

tempo2,fftw3 and cfitsio setup

TEMPO 2 is the newer pulsar timing package. FFTW3 is a fast fourier transformation library. CFITSIO is the NASA library for reading FITS format images. All of them are installed under $PSRHOME.  there’s another installation documenting file 00READMECarleton under that folder. FFTW3 and cfitsio are the dependencies for some of the tempo2 plugins and psrchive.

1. FFTW 3.3.4 is obtained from http://www.fftw.org/download.html,  unzip the tar file then

./configure –prefix=$PSRHOME/FFTW3/
sudo make
sudo make check
sudo make install

This will install the double precision FFTW3 library for TEMPO 2. However, the single-precision fftw
library that psrchive might require is not installed yet.

2.CFITSIO 3.370 is obtained from http://heasarc.gsfc.nasa.gov/fitsio/, unzip, cd, then

./configure –prefix=$SOFTWARE_DIR
sudo make shared
sudo make install

3. TEMPO2 is obtained by CVS anonymous checkout
cvs -z3 -d:pserver:anonymous@tempo2.cvs.sourceforge.net:/cvsroot/tempo2 co tempo2

The installation requires an amount of modification of config files (pgplot compilation flag, fixing bugs).
See 00REAMECarleton for details. But basically you do

./bootstrap
 setenv TEMPO2 $PSRHOME/tempo2/
 ./configure --prefix=$PSRHOME/tempo2/ --with-cfitsio-dir=$PSRHOME/cfitsio/ --with-fftw3-dir=$PSRHOME/FFTW3/ F77=f77
 sudo make && sudo make install
 sudo make plugins && sudo make plugins-install

-Yuping

printing postscript images to printer with gv (ghostview) as backup to evince

Bruce installed the gv package for viewing and printing postscript.  It works great for viewing.  For printing, it has problems.  Bruce developed this workaround (with a few mods by Joel):

‘gv’ uses the ‘lpr’ command, and if a printer as set as the default in CUPS it will use that printer automatically.  You can hear the printer warm up, but nothing comes out of the printer.

Fortunately ‘gv’ is packaged with a set of file conversion utilities,
including ‘ps2pdf’.  On the command line you can issue this command:

# ps2pdf xxx.ps – | lpr

and that will convert the ps file to pdf (version 1.4) before sending it to lpr.  (You can also convert in place – ie turn your postscript file into a pdf on disk with ps2pdf, and then send the pdf to the printer whenever you want.)

To print a ps on the fly, though:
gv’s print command dialog window has a typein labeled ‘print command’
and it’s automagically populated with the string ‘lpr’.  However you
can change that string to ‘ps2pdf %s – | lpr’.  You can also change
the default print string from ‘lpr’ to whatever you want in
GhostScript options, but that would break printing of non .ps Here’s.

To change the default print string in ‘gv’, select:

State->Setup Options

… Look for the Print Command field, and change the value from
‘lpr’ to ‘ps2pdf %s – | lpr’ (w/o the single quotes).

The change is saved to ~/.gv as the line:

GV.printCommand:        ps2pdf %s – | lpr

 

–bruce via joel

To access weekly online backup on canopus last updated 2024 August

Newest update 2024 Aug to reflect that backups are have been stored on canopus: for several years:

Go to canopus:/thuban2-backups

Bruce has an automatic (cron) job do a weekly backup of thuban onto canopus.

On canopus,

df -h gives the various mount points, incl
“Filesustem” /dev/mapper/centos_canopis-thuban2–backups”\
” Mounted on”  /thuban2/backups

Navigate down to whatever file you’re looknig for, and copy over to a safe place (Careful: do not overwrite newer file of same name on thuban!)

See also post on root superuser privileges on thuban2  (although current post you are reading deals with canopus, which is where weekly backups are stored).

–joel

plot to postscript file and to screen in same program

One might want to plot to screen, interactively adjust parameters, replot to screen, etc; and then when done fiddling; make a final postscript plot.  However, . . .

As far as I know, it is a little complicated to plot both to screen and to postscript.  One has to send essentially the same commands to each “device”, while also opening and closing them properly.

A good example of doing this is in combine_v7.0.pro, in /usr/share/astro/idlshare/local/recombo2008

————————————————————————————

A simpler version of this problem is the either/or problem – ask user whether she wants to plot to screen OR postscript.

A good example of this is profile_v4.5.pro [in its pro make_plots]

–Joel

Howto restore files from SDLT magtape

First shutdown Algol, then turn on both tape drives, then reboot Algol. This step is necessary because SCSI devices (such as the tape drives) can only be recognized at boot time.

When restoring files/dirs, supply the ‘-P’ arg to tar.  This is a workaround that causes tar to properly restore all symlinks. Otherwise random symlinks end up as zero-length files…

Also, when restoring files, cd to /root/tapebackup/restore/ and when issuing the ‘tar’ command, omit the leading ‘/’ and wrap the filename in single quotes, so that special chars in the filepath don’t get mis-interpreted.  Here’s an example:

[root@algol restore]# mt -f /dev/nst1 rewind
[root@algol restore]# tar xvPf /dev/nst1 'data/psrdata/usr3applications/p1391/vaxplot/temps_working/P1929+10/P1929+10_TMPfxd1.inp.Z'
/home /data/psrdata /usr/share/astro /etc/secret /docs Fri Apr 13 20:00:00 CDT 2012
Reading `/home /data/psrdata /usr/share/astro /etc/secret /docs Fri Apr 13 20:00:00 CDT 2012'
data/psrdata/usr3applications/p1391/vaxplot/temps_working/P1929+10/P1929+10_TMPfxd1.inp.Z
[root@algol restore]# ls
data
root@algol restore]# mt -f /dev/nst1 eject
[root@algol restore]#

Then copy the restored file from /root/tapebackup/restore to it’s final destination.

adding titles to postsript file displays on screen

The following was significantly updated on 30 May 2012 and again on Aug 2014:

idl and pgplot and many other postscript plotting routines have this annoying “feature” wherein, the output postscript file, when displayed with evince (“evince <filename> &”), goes into a window whose banner does NOT give its filename.  This is confusing if one is looking at multiple files.  We would prefer that the banner gives the name of the displayed file.

E.g., if the postscript file was produced with pgplot,  the window banner says “PGPLOT postscript plot”, rather than giving the file name.

E.g., if the postscript file was produced with IDL,  the window banner says “Graphics produced by IDL”, rather than giving the file name. (NOTE ADDED AUG 2014: YUPING HAS CREATED A SCRIPT INSIDE IDL TO GENERATE A FILENAME TAG ON PS FILES. SEE HIS POST!)

The reason is, that it writes into the file itself that the title is “PGPLOT postscript plot”; i.e., it literally writes “%%Title: PGPLOT postscript plot”
(or something similar for the IDL) into the postscript file.

After much effort, I have realized that evince will automatically display the desired filename rather than the above useless info, if only
one eliminates the whole “”%%Title” line.  (My first solutions, rather than eliminating that line, wrote the filename in the “%%Title” line.)

Inside IDL itself, I  think it is not possible either to alter or to eliminate the %%Title line as the postscript file is written because the drivers are proprietary.  Therefore one must fix the postscript file afterwards.  (The web shows how to run a unix script inside IDL that does so.)

Inside pgplot itself, one CAN fix the drivers so as to eliminate the offending %%Title line: Go to  drivers/psdriv.f

———–

To fix up a postscript file after the fact:

Joel has written a script (whose original was made and embellished by Joe Swiggum), joelpslabel, which

1. writes a new file whose name is the same as the original postscript file except
–Its name has an added “label” before the dot in the original file name
–Its modification date is listed as being identical (at least to the minute) with the original file name  (as in “ls -al”) so that you know when the original was created. (This was hard!!!!!!!!!!!!)

2. The script then runs evince on the new file, thereby putting on the screen something identical to the old file but with a banner that gives the old file name

———————

The new file with the new name having “label” in it stays on disk, and the original file is untouched, and they both have the same (claimed) date on them.  I do this because an older version of this script, which actually overwrote the original, sometimes got confused and the original was destroyed, requiring an archival search of old backups.  The downside is of course twice as much disk space but hey disk space is cheap and easy these days.

One can run joelpslabel on the original file as many times as one likes – each time overwriting the “new” file but assigning it the date of the orig file.

One can also run evince on the new file infinite times. The only downside there is that the banner will give the newfilename the 2nd-infinite time, rather than the old file name.  (The newfilename = oldfilename + “label”)

Known problem: The script searches for the first “.” in the filename and places “label” before it, so if your filename has more than one dot before “ps”, the name will be very screwy.  joel.weisberg.ps -> joellabel.weisberg.ps