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

movx=movx-9.09798
;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.

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

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

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.)

oplot,movx,movsect,psym=4
;overplots the x and y values for the multiplied up cut piece and overlays it on the original plot

device,/close
;closes the device

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

stop
;stops

end
;ends program

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