[Tutor] Help with a Conversion
S. P. Molnar
s.molnar at sbcglobal.net
Thu Jan 5 08:29:33 EST 2017
I have just started attempting programming in Python and am using Spyder
with Python 3.5.2 on a Linux platform. (I first started programing in
Fortran II using punched paper tape. Yes, am a rather elderly . . .).
I have bumbled through, what I foolishly thought was a simple problem, a
short program to change frequency to wavelength for a plot of
ultraviolet spectra. I have attached a pdf of the program.
During my attempt at programming I have printed results at various
stages. Printing wavelength = [row[0] for row in data] gives me 25000
as the first frequency in the wavelength list (the corresponding
wavelength is 400).
To change the frequency to wave length I did the following:
p=1/1e7
wave_length = p*np.array(frequency)
(The relationship between wavelength and frequency is: wavelength =
1.0e7/frequency, where 1e7 is the speed of light)
Apparently whhat I have managed to do is divide each element of the frequency list by 1/1e7.
What I want to do is divide 1e7 by each element of the freqquency list.
How di I do this?
Please keep in mind that many, many hyears ago I learned the ole arithmetic and an not trying to start a flame war.
Thanks in advance for the assistance tha I am sure will be most helpful.
--
Stephen P. Molnar, Ph.D. Life is a fuzzy set
www.Molecular-Modeling.net Stochastic and multivariate
(614)312-7528 (c)
Skype: smolnar1
More information about the Tutor
mailing list