|
I have compiled the function center1d as a standalone executable to be run in PyRAF (my purpose for doing this is that I'd like to know what "centroids" autoidentify will find prior to running the task). However, I am having trouble determining how to create the parameter file for this "task", since one of the parameters is an array of unknown length. STSci posts an example here http://stsdas.stsci.edu/documents/SPP/SP_16.html that looks like this:
[quote:475c9d02d1]vecreal,ar,a,1,3,1,,,"real vector elements", 0.0,1.2,3[/quote:475c9d02d1]
where their array is declared to be a length of 3. My main question is: Since the SPP program can apparently accept arrays of arbitrary length (as long as you also pass the array length as a separate variable), how do you tell the parameter file to look for an arbitrary length array? (I've tried to use npts--the size of the array--as well as ARB and INDEF, none of which worked.)One kludge would be to simply rewrite the parameter file before calling the task, where I set the expected array length to the known length of the array being passed. Of course, this is far from ideal. I'd also like to not have to go through the (in the age of ~1GB RAM/system) antiquated process of dumping my array to a file and having center1d read the file. Since I'm working with images, I could hack center1d to accept an image and pull the data array from the image, but I'd rather use the original format of input for center1d (and I'd also rather not delve too deeply into SPP program).While I'm at it, is there a general reference for how to create .par files for PyRAF (since they seem to allow more than the IRAF .par files)?Thanks for any help!
Matt
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
To be honest I'd have to look this up to give you code examples for dealing with CL arrays, but since both CL arrays and PyRAF are ST products maybe you should also contact their still-working HelpDesk (help@stsci.edu) 8-)Seriously, my first thought is that since center1d is normally used for small numbers of points a better (i.e. simpler) approach might be to construct a string of your values and pass them in as a string parameter. This is a simple clgstr() call in the SPP wrapper task that would then scan the string for the array values
(and collect things like the threshold param) before calling center1d(). It makes both the SPP and PyRAF sides easier to do.[quote:8f23d3d2e1]While I'm at it, is there a general reference for how to create .par files for PyRAF (since they seem to allow more than the IRAF .par files)? [/quote:8f23d3d2e1]This really [i:8f23d3d2e1]is[/i:8f23d3d2e1] actually a question for ST, however I did find http://stsdas.stsci.edu/pyraf/doc/pyraf_guide/node10.htmlwhich discusses the [i:8f23d3d2e1]makeIrafPar()[/i:8f23d3d2e1] factory object that has an [i:8f23d3d2e1]array_size[/i:8f23d3d2e1] which may be of interest to you. Hope this helps.-Mike
|