Posted: Wed Sep 21, 2011 11:01 am Post subject: PSELECT
I have the problem of removing the psf stars from the .nst or .psg files in order to subtract only the neighbouring stars to the psf stars. They are the first stars in each group.
I am creating a script so I want to automate it in stead of removing each psf star manually.
Is it possible, by using the task PSELECT, to compare different records with each other, eg. expr = "GROUP == (previous record/line GROUP)" in order to copy only the non-psf stars to another file.
Or is there maybe a better way of doing something like this which will work in a script?
I don't know how to use pselect, but I've worked around your problem in other ways.
As it happens, you can put the relevant .pst file in the exclude option for substar, and that solves the problem of having to make another nst file completely.
It's not in the Massey/Davis 1992 document, which is unfortunate, because I figured the whole pst thing out AFTER I wrote some IDL code that does make a new NST file. I'd be happy to give a copy of the code to someone to help them out, but this is what my does:
1. Uses the NASA IDL tools program readcol to read in the NST file. Readcol is a reasonably smart function and will ignore the second line per star, since the format does not mach the first line.
2. Makes a histogram of the column "group". This returns an array with the number of elements in each group, in order, and doesn't care WHAT they are.
3. Gets the number of unique elements of the column group (same as the number of elements in our histogram).
4. Makes a new nst file numbered n+1
5. Reads in the old nst file AGAIN, this time line by line. The first 42 lines are pumped in directly to the new file.
6. Now we loop over the number of groups. First we read the next two lines into a dummy variable.
7. If our histogram tells us there is two or more stars in our group, we read in two lines for each additional star, writing them directly to our new nst file.
8. We loop until we are out of groups and close both nst files.
There may be a better way to do this, but that worked for me. Though seriously knowing about the .pst thing in substar would have saved me hours of time.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum