Re: difficulty using "linterp" command - need help making loop to exclude a value yet average others [message #77256 is a reply to message #77160] |
Fri, 12 August 2011 17:26   |
Jeremy Bailin
Messages: 618 Registered: April 2008
|
Senior Member |
|
|
On 8/12/11 4:26 PM, Emily Anne Moravec wrote:
> We are writing a program for our supervisor to take 8 spectra which
> are each a matrix of 16384 by 2. The part of the program we have
> already splits the matrices into single matrices. Which is the code
> below:
>
> fitfilename1 = '/Users/quasargroup/NGC3783/NGC3783 new data/X1dsum
> files/lbgu19010_x1dsum.fits'
> data1 = mrdfits(fitfilename1,1,hdr)
> w1 = data1.wavelength
> w1a=w1(*, 0)
> w1b=w1(*, 1)
> f1= data1.flux
> f1a=f1(*, 0)
> f1b=f1(*, 1)
> .... etc. through 8
>
> Then we must get a new graph with a span of wavelengths and
> interpolated flux values.
> Here is the wavelength grid for the eventual interpolation:
>
> wgrid=findgen(58400)*.01+1227 ; from 1227.00 to 1811.00
> help, /str, wgrid
>
> Here is where we are trying to interpolate:
>
> linterp, w1a, f1a, wgrid, fint1a
> linterp, w1b, f2b, wgrid, fint1b
> linterp, w2a, f2a, wgrid, fint2a
>
> ..... etc through 8
> But we get this error.
>
> % Compiled module: INTERPOLATEDSIXTEEN.
> MRDFITS: Binary table. 12 columns by 2 rows.
> MRDFITS: Binary table. 12 columns by 2 rows.
> MRDFITS: Binary table. 12 columns by 2 rows.
> MRDFITS: Binary table. 12 columns by 2 rows.
> MRDFITS: Binary table. 12 columns by 2 rows.
> MRDFITS: Binary table. 12 columns by 2 rows.
> MRDFITS: Binary table. 12 columns by 2 rows.
> MRDFITS: Binary table. 12 columns by 2 rows.
> Parameter 3 (New X Vector or Scalar) of routine LINTERP is
> undefined.
> Valid dimensions are: scalar 1
> Valid types are: byte int*2 int*4 real*4 real*8 Unsigned(i*2)
> Unsigned(i*4) int*8 Unsigned(i*8)
>
> Do we need to do something to our wgrid or to the interpolate command
> to get it to work?
>
> Also, in each of our 8 data sets, there is an increment of wavelength
> values where the value of the flux is 0, which will make the average
> of all 8 messed up. Do you have any ideas how to write a loop that
> goes through all of the wgrid values and averages the values of the
> interpolated flux values, but skips the flux values that are 0 and
> continues to the next? Is there a skip command? Would a where command
> work the best?
>
> Here is what I started with :
> for i=1227.00, (1227.00+58400*.01), 0.01 do ???
It seems to be complaining that wgrid is undefined. Can you show us the
code a little more specifically? From what you've said, I wouldn't
expect it to be undefined, so I suspect that there's something more
subtle happening within your code.
-Jeremy.
|
|
|