Hi Craig and Diab,
Many, many thanks to you both! That was a super fast response.
Both solutions work exactly as advertised.
Cheers,
David.
On 14 Sep 2013, at 00:38, Craig DeForest wrote:
> Nice, Diab. It's easy to forget that CFITSIO offers the most fine-grained
> control.
>
> I just checked into git a patch to let you do
> wfits([$a,$b,$c],'foo.fits');
> and recover the data with
> @images = rfits('foo.fits');
> You can get the extensions individually with
> $a = rfits('foo.fits[1]');
> $b = rfits('foo.fits[2]');
> $c = rfits('foo.fits[3]');
>
> Cheers,
> Craig
>
>
> On Sep 13, 2013, at 3:10 PM, Diab Jerius <[email protected]> wrote:
>
>> Here ya go:
>>
>> use PDL;
>>
>> use Astro::FITS::CFITSIO qw/ :constants /;
>> use Astro::FITS::CFITSIO::CheckStatus;
>>
>> tie my $status, 'Astro::FITS::CFITSIO::CheckStatus';
>>
>> my $fits = Astro::FITS::CFITSIO::create_file( "!imgs.fits", $status );
>>
>> for ( 1 .. 10 ) {
>>
>> my $img = grandom( double, 100, 100 );
>>
>> $fits->create_img( DOUBLE_IMG, $img->ndims, [ $img->dims ], $status );
>> $fits->write_pix( TDOUBLE, [ 1, 1 ],
>> $img->nelem, $img->get_dataref, $status );
>> }
>>
>> On Fri, Sep 13, 2013 at 3:11 PM, David Wake <[email protected]> wrote:
>>> Craig, that would be fantastic!
>>>
>>> Diab, thanks for the suggestion. I was trying to avoid using
>>> Astro::FITS::CFITSIO and CFITSIO as I have very little experience with it
>>> and my attempts at googling for suitable example came up empty handed. If
>>> you could point me to one I would be happy to try that until Craig escapes
>>> the flooding!
>>>
>>> Many thanks,
>>>
>>> David.
>>>
>>>
>>> On 13 Sep 2013, at 14:02, Craig DeForest wrote:
>>>
>>>> I will try to insert that code over the weekend if full internet comes
>>>> back up for us ... phone just came back. #boulderfloood
>>>>
>>>> (Mobile)
>>>>
>>>>
>>>> On Sep 13, 2013, at 12:55 AM, Diab Jerius <[email protected]>
>>>> wrote:
>>>>
>>>>> On Thu, Sep 12, 2013 at 3:05 PM, David Wake <[email protected]> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I would like to be able to write a series of images (2d PDLs) into a
>>>>>> single FITS file with each image as an individual HDU.
>>>>>> Currently WFITS is unable to do this, although the functionality is
>>>>>> mentioned in the description of WFITS as coming soon.
>>>>>>
>>>>>> Does anyone have any suggestions for an alternative solution?
>>>>>>
>>>>>> Many thanks,
>>>>>
>>>>> If you don't mind a bit of low-level programming, Astro::FITS::CFITSIO
>>>>> (which interfaces to the CFITSIO library) can do that.
>>>>>
>>>>> _______________________________________________
>>>>> Perldl mailing list
>>>>> [email protected]
>>>>> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>>>>>
>>>
>>
>> _______________________________________________
>> Perldl mailing list
>> [email protected]
>> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>>
>
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl