Rcjp's Weblog

November 28, 1994

Graphics and Plotting during my Ph.D

Filed under: physics — rcjp @ 11:45 am

It seems like a considerable chunk of my time during my PhD was devoted to getting half decent graphics output. When I started everyone was using NAG which was fast but very basic. I got handed a three folders full of GINO manuals and asked to write something that would plot in colour on the new HP Deskjet printers.

I remember being very fed up that the department had paid several hundred pounds for a graphics library that, although it contained routines for fitting curves to datapoints, wouldn’t scale the graph axes to cope with that – you had to do that yourself!

    CCCC  ===================================================================
    CCCC  Converts the output from GINO type plot files for GNUPLOT to use   
    CCCC  ===================================================================
    CCCC  -------------------------------------------------------------------
    CCCC  Usage GCON "infile" "outfile"                                    
    CCCC  Version 1.0                                                     
    CCCC  Created 28/11/94[1.0]                                          
    CCCC  -------------------------------------------------------------------
          PROGRAM Convert
          PARAMETER (mdim = 150)
          DOUBLE COMPLEX pcmplx(mdim, mdim)
          REAL pcoor(mdim, mdim)
          CHARACTER*50 buf
          CHARACTER*50  title
          CHARACTER*1   choice
          INTEGER*4     count
          INTEGER*2     stat, i

          count = NARGS()
          IF (count .NE. 3) THEN
             PRINT *, 'SYNTAX: GCON infile outfile '
          END IF
          CALL GETARG(1, buf, stat)
          OPEN (10, file = buf(1:stat), STATUS='OLD')
          CALL GETARG(2, buf, stat)
          OPEN (11, file = buf(1:stat))

          READ(10,'(A)') title
          READ(10,*) nx,xmin,xmax,ymin,yinc
          do j=1,mdim
             read(10,*,end=10) (pcmplx(i,j),i=1,nx)
          print *,'****array out of bounds, increase mdim****'

     10   CONTINUE
          ny = j - 1
          PRINT *,' Real (R), Imaginary (I), Absolute Squared (A) ?'
          READ '(A)', choice

          IF (choice.eq.'R' .OR. choice.eq.'r') THEN
             DO i = 1, nx
                DO j = 1, ny
                   pcoor(i,j) = REAL(pcmplx(i,j))
                END DO
             END DO
          ELSEIF (choice.eq.'I' .OR. choice.eq.'i') THEN
             DO i = 1, nx
                DO j = 1, ny
                   pcoor(i,j) = AIMAG(pcmplx(i,j))
                END DO
             END DO
          ELSEIF (choice.eq.'A' .OR. choice.eq.'a') THEN
             DO i = 1, nx
                DO j = 1, ny
                   pcoor(i,j) = CABS(pcmplx(i,j))**2
                END DO
             END DO

          xinc = (xmax - xmin) / nx
          DO j = 1, ny
             DO i = 1, nx
                WRITE(11,20) xmin + xinc*(i-1), ymin+(j-1)*yinc, pcoor(i,j)
    cccc  WRITE(6,20) xmin + xinc*(i-1), ymin+(j-1)*yinc, pcoor(i,j)                                                                     
             END DO
             WRITE (11,'(A)')
          END DO
     20   FORMAT (1x, 3(E12.6,1x))


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: