Data Shifting

This program shifts the data in the directory that you're in by the amount you put in. This is heavily commented to make sure that it's clear what's happening in each line.

pro optshiftprint
;idl filename optshiftprint

readcol, '11062006doubleall', F='D,D,D,D,D,D',one,two,three,four,five,six;
;readcol tells it to read the file as columns
;the file to be read
;the format to be read, in this case D is to read the numbers in as "double"
;label each column the names, "one, two…"

flux = three/six
;flux is now the name of the value for the number in column 3 divided by the number in column 6

err = four/six
;err is the name … see above

contin = six
;assigning the name "contin" to column six. Could have originally assigned this column "contin", too

increase = (1608.4511*0.058)/(1611.2005*0.00136)
;This comes from the physics. The ratio of the optical depth of two absorption lines is
;(the oscillator strength times the emission wavelength)/(osc. strength * wavelength of the other)

fluxlog = -alog(flux)
;assigning "fluxlog" to be the negative natural log of variable "flux"

fluxlog[n_elements(fluxlog)-200:n_elements(fluxlog)-1]= increase*fluxlog[n_elements(fluxlog)-200:n_elements(fluxlog)-1]
;reassigning the elements in the "fluxlog" that are in the last 200 data points to be multiplied
;by the "increase" so the two optical depths should be equivalent.

movsect = fluxlog[n_elements(fluxlog)-200:n_elements(fluxlog)-1]
;assigning the y values of the section that's going to be moved

movx = two[n_elements{fluxlog)-200:n_elements(fluxlog)-1]
;assigning the section of the data plot to move along the x-axis

;The amount to actually shift the section along the x-axis, in this case 9.09798

;forprint, two, 1 - flux, Format = '(D,D)',TEXTOUT = 'opttryplot.dat',/nocomment
;commented out command that would output the asii file into a format that vpfit could read

;plot, two, 1 - flux, linestyle=0
;commented out line that was used to check that the cuts were made correctly

fluxcutlog = fluxlog[0,n_elements(fluxlog)-200-1]
;assigning the variable "fluxcutlog" to the first part of the data.

;this is the part where we print out the results to a postscript file. set the output plot to postscript.

device, filename=''
;run the plot, and name the output ""

plot, two, fluxcutlog, psym=3, xrange=[5320,5326], yrange=[-1,max(movsect)], $
xtitle='Angstroms', ytitle='Optical Depth', title='Theory predicted shift'

;first, the $ continues the command on the next line.
;second, this is where we tell it to plot, "two" and "fluxcutlog" (and assign the ranges, title, etc.)

;overplots the x and y values for the multiplied up cut piece and overlays it on the original plot

;closes the device

;returns plot function to it's default screen display (no longer postscript)


;ends program

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.