#!/usr/bin/perl

# Copyright (C) 2005  Joshua Hoblitt
#
# $Id: 03_gene_example.t,v 1.1.1.1 2005-03-01 03:41:05 jhoblitt Exp $

use strict;
use warnings FATAL => qw( all );

use lib qw( ./lib );

use Test::More tests => 1;
use PS::IPP::Metadata::Config;

my $example = do { local $/; <DATA> };

my $config_parser = PS::IPP::Metadata::Config->new;
my $pt = $config_parser->parse( $example );

ok( defined( $pt ), "valid parase tree");

__DATA__
# these are examples of camera definition variables:
# skyprobe
NCELL       S32    1
NCHIP       S32    1
#                  FILENAME    EXTNAME  REGION      CHIP      BIASSEC     
CELL.00     STR    %f00.%x     PHU      [0,0:0,0]   CHIP.00   [0,0:0,0] 
                   
# megacam-raw      
NCELL       S32    72
NCHIP       S32    36
#                  FILENAME    EXTNAME  DATASEC     CHIP      BIASSEC     
CELL.00     STR    %f.%x       AMP00    [0,0:0,0]   CHIP.00   BIASSEC
CELL.01     STR    %f.%x       AMP01    [0,0:0,0]   CHIP.00   [2100,2110:0,4096]   
CELL.02     STR    %f.%x       AMP02    [0,0:0,0]   CHIP.01   [0,0:0,0]   
CELL.03     STR    %f.%x       AMP03    [0,0:0,0]   CHIP.01   [0,0:0,0]   

# megacam-splice
NCELL       S32    72
NCHIP       S32    36
#                  FILENAME    EXTNAME  REGION      CHIP      BIASSEC   TRIMSEC
CELL.00     STR    %f.%x       CCD00    ASEC-00     CHIP.00   BSEC-00   DSEC-00
CELL.01     STR    %f.%x       CCD00    ASEC-01     CHIP.00   BSEC-01   DSEC-01
CELL.02     STR    %f.%x       CCD01    ASEC-00     CHIP.01   BSEC-00   DSEC-00
CELL.03     STR    %f.%x       CCD01    ASEC-01     CHIP.01   BSEC-01   DSEC-01

# cfh12k-split
NCELL       S32    12
NCHIP       S32    12
#                  FILENAME    EXTNAME  REGION      CHIP      BIASSEC     
CELL.00     STR    %f/%f00.%x  PHU      [0,0:0,0]   CHIP.00   [0,0:0,0]   
CELL.01     STR    %f/%f01.%x  PHU      [0,0:0,0]   CHIP.01   [0,0:0,0]   
CELL.02     STR    %f/%f02.%x  PHU      [0,0:0,0]   CHIP.02   [0,0:0,0]   

# cfh12k-mef
NCELL       S32    12
NCHIP       S32    12
#                  FILENAME    EXTNAME  REGION      CHIP      BIASSEC     
CELL.00     STR    %f.%x       CHIP00   [0,0:0,0]   CHIP.00   [0,0:0,0]   
CELL.01     STR    %f.%x       CHIP01   [0,0:0,0]   CHIP.01   [0,0:0,0]   
CELL.02     STR    %f.%x       CHIP02   [0,0:0,0]   CHIP.02   [0,0:0,0]   

#- REGION can be defined by a header keyword in IRAF format or by a explicit IRAF format 
#- what is default for NAXIS1,2 for IRAF format?
#- Nreadout is always NAXIS3?

# recipe file:
# this makes the assumption that, for a given camera, all chips &
# cells have the same recipe.  this is probably a good start, but may
# not cut it in general. eg, it is already clear that for 

# recipe file must be a function of time and camera.
# 

# BIAS:
BIAS.IMAGE                 STR    NONE
BIAS.IMAGE  		   STR    FILE:bias.fits
BIAS.IMAGE  		   STR    DB:BEST
BIAS.IMAGE  		   STR    DB:CLOSE

BIAS.OVERSCAN 		   STR    HEADER:BIASSEC
BIAS.OVERSCAN 		   STR    RECIPE:[0,0:0,0]
BIAS.OVERSCAN 		   STR    NONE

BIAS.OVERSCAN.STATS 	   STR    MEDIAN
BIAS.OVERSCAN.STATS 	   STR    MEAN

BIAS.OVERSCAN.FIT          STR    SPLINE
BIAS.OVERSCAN.FIT.NPTS     S32    5

BIAS.OVERSCAN.FIT          STR    POLYNOMIAL
BIAS.OVERSCAN.FIT.ORDER    S32    3
BIAS.OVERSCAN.FIT.NBIN     S32    5
