File: vimos_chop_region-test.c

package info (click to toggle)
cpl-plugin-vimos 4.1.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 28,228 kB
  • sloc: ansic: 169,271; cpp: 16,177; sh: 4,344; python: 3,678; makefile: 1,138; perl: 10
file content (89 lines) | stat: -rw-r--r-- 2,528 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* $Id: vimos_chop_region-test.c,v 1.1 2015/10/16 12:34:11 jim Exp $
 *
 * This file is part of the CASU Pipeline utilities
 * Copyright (C) 2015 European Southern Observatory
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/*
 * $Author: jim $
 * $Date: 2015/10/16 12:34:11 $
 * $Revision: 1.1 $
 * $Name:  $
 */

#include <stdio.h>
#include <stdlib.h>

#include <cpl_init.h>
#include <cpl_test.h>
#include <casu_utils.h>
#include <casu_mods.h>
#include <vimos_chop_region.h>
#include <vimos_imaging_utils.h>
#include <vimos_mods.h>

int main(void) {
    cpl_image *im1;
    casu_fits *sci;
    int status,retval,ix,iy;
    cpl_propertylist *p;

    /* Initialise */

    cpl_test_init(PACKAGE_BUGREPORT,CPL_MSG_WARNING);

    /* Create an image */

    im1 = cpl_image_new(2048,2440,CPL_TYPE_FLOAT);
    p = cpl_propertylist_new();
    cpl_propertylist_update_string(p,"ESO DET CHIP1 ID","BRIAN");
    sci = casu_fits_wrap(im1,NULL,NULL,p);
    cpl_propertylist_delete(p);

    /* That the correct bit has been chopped off */

    status = CASU_FATAL;
    retval = vimos_chop_region(sci,1,&status);
    cpl_test_eq(status,CASU_FATAL);
    cpl_test_eq(retval,CASU_FATAL);
    status = CASU_OK;
    retval = vimos_chop_region(sci,1,&status);
    cpl_test_eq(status,CASU_OK);
    cpl_test_eq(retval,CASU_OK);
    ix = trimreg_new[0][1] - trimreg_new[0][0] + 1;
    iy = trimreg_new[0][3] - trimreg_new[0][2] + 1;
    cpl_test_eq(cpl_image_get_size_x(casu_fits_get_image(sci)),ix);
    cpl_test_eq(cpl_image_get_size_y(casu_fits_get_image(sci)),iy);
    cpl_test_eq(cpl_propertylist_get_bool(casu_fits_get_ehu(sci),
                                          "ESO DRS CHOPCOR"),1);

    /* Get out of here */

    casu_fits_delete(sci);
    return(cpl_test_end(0));

}

/*

$Log: vimos_chop_region-test.c,v $
Revision 1.1  2015/10/16 12:34:11  jim
new



*/