View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Plotting and doing calculations on text files.

H.J. van Heerden wrote on May 16, 2007

Hi all.

The differential photometry pipeline I'm building is basically done. Now I would like to do some extra "stuff"

When the psf photometry task has run, I use a script to dump the neccesary fields with the help of "txdump" to a text file. Example.

filter, UT, airmass, x, y, mag, merr, msky

C  21.7125  1.1263  123.504  168.433  17.818  0.105  99.14249
C  21.97889  1.0943  129.220  168.887  17.592  0.197  98.11974
C  22.06083  1.0856  126.199  167.901  17.868  0.079  95.80301
C  22.06944  1.0847  123.981  168.482  17.596  0.053  96.85553
C  22.07889  1.0838  125.041  168.080  17.726  0.078  96.39429
C  22.10028  1.0816  126.438  168.281  17.590  0.062  96.6115
C  22.10944  1.0807  130.006  167.818  17.469  0.096  95.07929
C  22.11889  1.0798  128.163  167.668  17.587  0.086  94.79146


What I would like to do is correct the mag for atmospheric cond.
"v = v0 - k'X" X = airmass, k' = const

What I would also like to do is plot a lightcurve, mag vs UT with errorbars, and save it, to print later.

Thus! What packages can I use to accomplish the above mentioned?

Thanx
Pat.

Mike Fitzpatrick wrote on May 16, 2007

Hi Pat,

As a first pass, see the SGRAPH task in the TABLES.TBPLOT package. You can view the help page from the menubar above.

Cheers,
-Mike

H.J. van Heerden wrote on May 16, 2007

Hi Mike

Been studying the TABLES package today. Modified stardump so that it now uses TABLES.TTOOLS.TCREATE to also create tables for the stars being dumped. I.e get a text/data file a.w.a. table file. :)

(Text file is for those who prefer to use external data analysis software)

TPRINT is also a handy tool. :D

Using TCALC to calculate the airmass corrected magnitudes using the instumental from the star#.tab tables. :wink:

Also figured out how to plot data a.w.a the errorbars for data from the star#.tab tables using SGRAPH task.

Only problem now is - How can I save the image/plot. Also I expect that to print the plot, just pipe the sgraph to STDOUT?? :?:

Thanx
Pat

Mike Fitzpatrick wrote on May 16, 2007

Pat,

To save the plot (I assume you mean a Postscript version of it?) you would simply set the dvpar.device parameter to be something like 'psdump', likewise you would set it to 'lpr' to have it print. Note your script should include a 'gflush' after doing this to flush the graphics buffer.

Note the 'psdump' device creates a file /tmp/irafdmpXXX.ps where the XXX is some process ID. There isn't a way to create a file with a specific name unless you create a private graphcap entry for it.

-Mike

H.J. van Heerden wrote on May 16, 2007

Hi Mike

The pipeline is now up and running. :D
The psdump works, wrote a small script to go and catch it from the tmp/ dir and rename to the appropreate filename. I expect that the same can be done for eps files? :wink:

The pipeline now only has to be calibrated, will be done with a full data set that I will be aquiring early next month.

It does the reductions, psf photometry, atmospheric corrections, and plots lightcurves. :) Nice!

Thanx for all the help. Will stay in touch. Still has a lot to do i.t.o. photometry research! :wink:

Regards
Pat

Mike Fitzpatrick wrote on May 16, 2007

Hi Pat,

Glad to hear you've made such good progress!


The psdump works, wrote a small script to go and catch it from the tmp/ dir and rename to the appropreate filename. I expect that the same can be done for eps files?


It can, except by default the 'eps' device name writes a file called 'sgiXXX.eps' in the current directory instead of /tmp like 'psdump'. Note that in neither case are the files removed unless you do it so you need to be sure you're getting the latest file from your script and there aren't conflicts with other scripts running simultaneously. One way to do this is to create a special entry for the plot that overwrites the same file (except for the simultaneous case) such as


eps|Encapsulated Postscript file (portrait) UNIX:\
    :XO#300:XW#1950:YO#1000:YW#1300:PW#1.2:\
    :DD=eps,tmp$sgk,!{ sgidispatch sgi2ueps $F -l$(XO) \
    -w$(XW) -b$(YO) -h$(YW) -p$(PW) > epsdump.eps; rm $F; }&:tc=sgi_apl:

psdump|UNIX generic interface to PS file dump:\
    :DD=psdump,tmp$sgk,!{ sgidispatch sgi2uapl $F -l$(XO) -w$(XW) \
    -b$(YO) -h$(YW) -p$(PW) > psdump.ps ; rm $F;}&:tc=sgi_apl:


This defines two entries, 'eps' and 'psdump' respectively, that create a specific file, 'epsdump.eps' and 'psdump.ps' respectively, in the current directory. If you edit the dev$graphcap file and put these in near the top of the file you can use these device names to get predictable output filenames. The sizes and resolutions can also be tweaked using this technique.

Cheers,
-Mike

Last post on May 16, 2007