This is effectively more efficient and gives me the solution to implement in my future script.
One more question about format : how to put a leading '0' in RA when the hours are on one digit, e.g. 05:19:58.00 instead of 5:19:58.00 ?
Thanks again for your hints,
> WCSTRAN will only convert one position at once. The other option is
> to use asttran2 command in the starlink ATOOLS package (ATOOLS
> provides a command line interface for the AST library and so is a
> little more low level than KAPPA). The asttran2 command allows you to
> transform many positions at once within the same image:
>
> % atools
> % asttran2 lm04510_newwcs.sdf xin=^xvals.lis yin=^yvals.lis forward=yes \
> xout=ravals.lis yout=decvals.lis quiet=yes
>
> This reads grid coordinates (i.e. pixel coords relative to the bottom
> left corner) from text files "xvals.lis" and "yvals.lis". Each should
> contain a list of numerical pixel axis values, with one value per
> line. It writes the corresponding ra and dec to files ravals.lis and
> decvals.lis. These are floating point values in radians so you
> probably want to format them into sexagesimal format, which you can do
> as follows:
>
> % astformat lm04510_newwcs axis=1 value=^ravals.lis result=ratext.lis quiet
> % astformat lm04510_newwcs axis=2 value=^decvals.lis result=dectext.lis quiet
>
> (results are then in text files ratext.lis and dectext.lis)
>
> As Tim points out, you can control how the ra and dec values are
> formatted by assigning values to the Format(1) and Format(2)
> attributes of the NDF lm04510_newwcs.sdf. You can do this using either
> kappa:wcsattrib or atools:astset. Tim showed how to use
> kappa:wcsattrib. To use atools:astset, do:
>
> % astset lm04510_newwcs 'Format(1)' hms.2
> % astset lm04510_newwcs 'Format(2)' dms.1
>
> There are many other ways to control the formatting - see the
> SkyFrame section at
> http://docs.jach.hawaii.edu/star/sun211.htx/node455.html
>
> David
>
>
>
>
>
>
>
>
>
>
>
> On 23 November 2010 19:50, Tim Jenness <[log in to unmask]> wrote:
>> On Nov 23, 2010, at 8:18 AM, Jean-Baptiste Marquette wrote:
>>
>>> Yes, it works in interactive mode :
>>>
>>> MacBookJB:Downloads marquett$ wcstran lm04510_newwcs.fits framein=pixel frameout=sky
>>> POSIN - Position to be transformed /'500,500'/ > 500,500
>>>
>>> p1 = 500.0 p2 = 500.0 --> RA = 5:19:58.0 Dec = -65:07:18
>>>
>>
>> Works for me:
>>
>> $ wcstran test '"500, 500"' framein=pixel frameout=sky
>>
>> p1 = 500.0 p2 = 500.0 --> RA = 5:19:58.0 Dec = -65:07:18
>>
>>
>> It fails when you use a decimal "500." without an additional number. So the parser expects "500.0" or "500" but "500." fails. Note that your example run above did not have the decimal in it but the command line test did.
>>
>>
>>> My point is that I will have 15 Tb of images to autoastrom to get the QV keywords, and then to rebuild a catalogue of 87 million objects using wcstran, so I do need the command-line mode.
>>
>> All Starlink command-line apps can run in scripts.
>>
>>> Also, how to modify the number of digits on seconds on the output to get ss.ss on RA and ss.s on DEC ?
>>>
>>
>> To get more digits in the output you need to run the wcsattrib command and this really means that you need to convert the file to NDF first. WCSTRAN does not let you modify the formatting itself.
>>
>> $ wcsattrib test set 'format(1)' hms.2
>> $ wcsattrib test set 'format(2)' dms.1
>> $ wcstran test '"500.0,500.0"' framein=pixel frameout=sky
>>
>> p1 = 500.0 p2 = 500.0 --> RA = 5:19:58.00 Dec = -65:07:18.3
>>
>>
>> --
>> Tim Jenness
>>
================================================
Bien cordialement/Very truly yours/Mit freundlichen Gruessen,
Jean-Baptiste Marquette
Institut d'Astrophysique de Paris
CNRS - UMR 7095
Université Pierre & Marie Curie
98bis Bd Arago
75014 Paris - France
================================================
|