parameter rederection
christian wrote on Apr 29, 2008
Hello again :)
I wonder if there is an easy way to redirect the output of one task to the input of another task. So what I want to do in general is using imcentroid to get the center coordinates of a source and then center this source in the image (by using imshift).
The only way to do this in a procedure script seems to redirect the imcentroid output to some file and then searching the file for the center coordinates which is a little bit painfull....
Is there any possibility to do this in an easier way ? (Or at least a way to tell imcentroid that it shall only print the coordinates and nothing else ?)
regards
christian
I wonder if there is an easy way to redirect the output of one task to the input of another task. So what I want to do in general is using imcentroid to get the center coordinates of a source and then center this source in the image (by using imshift).
The only way to do this in a procedure script seems to redirect the imcentroid output to some file and then searching the file for the center coordinates which is a little bit painfull....
Is there any possibility to do this in an easier way ? (Or at least a way to tell imcentroid that it shall only print the coordinates and nothing else ?)
regards
christian
Mike Fitzpatrick wrote on Apr 29, 2008
Since what you want is to redirect the output of one task into the values of two separate parameters, then no, this cannot be done. Some tasks *can* be chained together using pipes and specifying the input/output params to be STDIN/STDOUT respectively, but not in this case.
That said, things can be made a lot simpler. For example, the FIELDS task can be used to select columns from the output, and in the case of a single object you could pipe this to scan() to save the results to local variables. For example
For multiple objects you would save the intermediate file and loop over the result.
Cheers,
-Mike
That said, things can be made a lot simpler. For example, the FIELDS task can be used to select columns from the output, and in the case of a single object you could pipe this to scan() to save the results to local variables. For example
cl> imcentroid input.fits ref.fits coords.txt verbose- | fields STDIN "2,4" | scan (x,y)
cl> imshift input.fits output.fits xshift=x yshift=y
For multiple objects you would save the intermediate file and loop over the result.
Cheers,
-Mike
christian wrote on Apr 29, 2008
had to play a little bit around with it, but this finaly did the job.... Thank You !
christian
christian
Last post on Apr 29, 2008